Whamcloud - gitweb
LU-10391 socklnd: use interface index to track local addr 02/37702/11
authorMr NeilBrown <neilb@suse.de>
Fri, 7 Feb 2020 02:05:57 +0000 (13:05 +1100)
committerOleg Drokin <green@whamcloud.com>
Tue, 14 Apr 2020 08:09:20 +0000 (08:09 +0000)
commitd720fbaadad9343a481863ae3b04ba580541328d
tree0b331fe35be074fcbae32e58c81513546e6b27e7
parent1477027d073be1efb6ffbb368ed68b97a65c72f1
LU-10391 socklnd: use interface index to track local addr

socklnd currently uses local IP addresses to track the local end of a
route or connection.  This will not work so well for IPv6 where
addresses are generally more dynamic - an interface can have several
addresses and they can come and go.

Even with IPv4, an interface can have multple addresses, though this
is partially hidden as there we normally use aliases which make it
looks like different interfaces: eth0:1 eth0:2 etc.  These are really
all the same interface, just with different addresses.

It is really the local interface, rather than the local address,
which is important.  Choosing the right interface ensures the traffic
goes over the desired network hardware.  Using an address, as the code
currently does, is just a convenient indirection.

With IPv6, using the interface directly will be easier, and it is
quite possible with IPv4.

So: this patch changes ksock_route to store an interface index for the
source end of the route, and adds the index nubmer to ksock_interface.

lnet_sock_listen() loses the local IP address which is never used, and
lnet_sock_connect() now is passed a source interface rather than a
source IP address.
lock_sock_create() also gets a local source interface.

Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: Ib3e0f92d10ad6ba4d66782bae22638e9935a1e4e
Reviewed-on: https://review.whamcloud.com/37702
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Aurelien Degremont <degremoa@amazon.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet/include/lnet/lib-lnet.h
lnet/klnds/socklnd/socklnd.c
lnet/klnds/socklnd/socklnd.h
lnet/klnds/socklnd/socklnd_cb.c
lnet/lnet/acceptor.c
lnet/lnet/config.c
lnet/lnet/lib-socket.c