# How would nginx record client IP address under TCP Multipath?

**URL:** <https://www.ruby-forum.com/t/how-would-nginx-record-client-ip-address-under-tcp-multipath/238314>\
**Category:** NGINX\
**Created:** [January 3, 2014, 1:50am UTC](https://www.ruby-forum.com/t/how-would-nginx-record-client-ip-address-under-tcp-multipath/238314 "2014-01-03T01:50:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [January 3, 2014, 1:50am UTC](https://www.ruby-forum.com/t/how-would-nginx-record-client-ip-address-under-tcp-multipath/238314/1 "2014-01-03T01:50:09Z")

</div>

Hello,

Since iOS7 supports TCP Multipath now, I think more and more devices  
will  
start support it.

But TCP Multipath allows many client IPs connected to the same server,  
suppose Nginx in this case, how would access\_log record all of the IPs?

Just curious question 🙂

---

<div class="post-metadata">

**Author:** ![est](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/74df32/32.png) [@est](https://www.ruby-forum.com/u/est)\
**Post date:** [January 3, 2014, 9:11am UTC](https://www.ruby-forum.com/t/how-would-nginx-record-client-ip-address-under-tcp-multipath/238314/2 "2014-01-03T09:11:16Z")

</div>

That’s very helpful info. Thanks!

So getsockname() and getpeername() returns the initial subflow, what’s  
the  
API to get other subflows?

Edit: found my answer:  
[RFC 6897 - Multipath TCP (MPTCP) Application Interface Considerations](https://datatracker.ietf.org/doc/rfc6897/?include_text=1) by  
using setsockopt() and getsockopt()

The functions getpeername() and getsockname() SHOULD also always  
return the addresses of the first subflow if the socket is used by an  
MPTCP-aware application, in order to be consistent with MPTCP-unaware  
applications, and, e.g., also with the Stream Control Transmission  
Protocol (SCTP). Instead of getpeername() or getsockname(),  
MPTCP-aware applications can use new API calls, described in  
Section 5.3, in order to retrieve the full list of address pairs for  
the subflows in use.

---

<div class="post-metadata">

**Author:** ![est](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/74df32/32.png) [@est](https://www.ruby-forum.com/u/est)\
**Post date:** [January 3, 2014, 2:43am UTC](https://www.ruby-forum.com/t/how-would-nginx-record-client-ip-address-under-tcp-multipath/238314/3 "2014-01-03T02:43:59Z")

</div>

Hi,

> Since iOS7 supports TCP Multipath now, I think more and more devices  
> will start support it.

Not if the servers don’t support it.

Apple pushed for a specific reason:  
To avoid having a broken TCP session when the IP address of the handheld  
changes, which would interrupt Apple’s Siri.

But TCP multipath is still not supported by linux mainline and I don’t  
see efforts on linux-netdev to include it anytime soon. I understand  
there  
is a maintained and uptodate patchset available, but that doesn’t mean  
it will be included in the kernel soon.

> But TCP Multipath allows many client IPs connected to the same server,  
> suppose Nginx in this case, how would access\_log record all of the IPs?

The application will always see the first IP, which connected to the  
server,  
as per:  
[http://lwn.net/Articles/545862/](http://lwn.net/Articles/545862/)

Regards,

Lukas
