choose_ip4_src() test "*ret" without initializing it - and callers do
not (and should not) initialize the var.
Instead of testing "*ret", test "err" - if this is non-zero (it will
be -ENOENT) we want to use the address. If it is zero, then we only
use the address if it is on the right subnet.
Test-Parameters: trivial
Reported-by: Amir Shehata <ashehata@whamcloud.com>
Fixes:
d720fbaadad9 ("LU-10391 socklnd: use interface index to track local addr")
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: I9b83207b790db07c06be1ee1c534a0fc63eb9ffa
Reviewed-on: https://review.whamcloud.com/38823
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Aurelien Degremont <degremoa@amazon.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Amir Shehata <ashehata@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
goto out;
err = -ENOENT;
in_dev_for_each_ifa_rcu(ifa, in_dev) {
goto out;
err = -ENOENT;
in_dev_for_each_ifa_rcu(ifa, in_dev) {
((dst_ipaddr ^ ntohl(ifa->ifa_local))
& ntohl(ifa->ifa_mask)) == 0) {
/* This address at least as good as what we
((dst_ipaddr ^ ntohl(ifa->ifa_local))
& ntohl(ifa->ifa_mask)) == 0) {
/* This address at least as good as what we