Merge branch 'ip-rework-the-fix-for-dflt-addr-selection-for-connected-nexthop'
Nicolas Dichtel says: ==================== ip: rework the fix for dflt addr selection for connected nexthop" This series reworks the fix that is reverted in the second commit. As Julian explained, nhc_scope is related to nhc_gw, it's not the scope of the route. ==================== Link: https://lore.kernel.org/r/20221020100952.8748-1-nicolas.dichtel@6wind.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
commit
bc520f5e25
|
@ -389,7 +389,7 @@ static int __fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst,
|
|||
dev_match = dev_match || (res.type == RTN_LOCAL &&
|
||||
dev == net->loopback_dev);
|
||||
if (dev_match) {
|
||||
ret = FIB_RES_NHC(res)->nhc_scope >= RT_SCOPE_LINK;
|
||||
ret = FIB_RES_NHC(res)->nhc_scope >= RT_SCOPE_HOST;
|
||||
return ret;
|
||||
}
|
||||
if (no_addr)
|
||||
|
@ -401,7 +401,7 @@ static int __fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst,
|
|||
ret = 0;
|
||||
if (fib_lookup(net, &fl4, &res, FIB_LOOKUP_IGNORE_LINKSTATE) == 0) {
|
||||
if (res.type == RTN_UNICAST)
|
||||
ret = FIB_RES_NHC(res)->nhc_scope >= RT_SCOPE_LINK;
|
||||
ret = FIB_RES_NHC(res)->nhc_scope >= RT_SCOPE_HOST;
|
||||
}
|
||||
return ret;
|
||||
|
||||
|
|
|
@ -1231,7 +1231,7 @@ static int fib_check_nh_nongw(struct net *net, struct fib_nh *nh,
|
|||
|
||||
nh->fib_nh_dev = in_dev->dev;
|
||||
netdev_hold(nh->fib_nh_dev, &nh->fib_nh_dev_tracker, GFP_ATOMIC);
|
||||
nh->fib_nh_scope = RT_SCOPE_LINK;
|
||||
nh->fib_nh_scope = RT_SCOPE_HOST;
|
||||
if (!netif_carrier_ok(nh->fib_nh_dev))
|
||||
nh->fib_nh_flags |= RTNH_F_LINKDOWN;
|
||||
err = 0;
|
||||
|
|
|
@ -2534,7 +2534,7 @@ static int nh_create_ipv4(struct net *net, struct nexthop *nh,
|
|||
if (!err) {
|
||||
nh->nh_flags = fib_nh->fib_nh_flags;
|
||||
fib_info_update_nhc_saddr(net, &fib_nh->nh_common,
|
||||
fib_nh->fib_nh_scope);
|
||||
!fib_nh->fib_nh_scope ? 0 : fib_nh->fib_nh_scope - 1);
|
||||
} else {
|
||||
fib_nh_release(net, fib_nh);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue