Commit bc520f5e authored by Jakub Kicinski's avatar Jakub Kicinski

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.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents ce48ebdd bac0f937
...@@ -389,7 +389,7 @@ static int __fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst, ...@@ -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_match = dev_match || (res.type == RTN_LOCAL &&
dev == net->loopback_dev); dev == net->loopback_dev);
if (dev_match) { 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; return ret;
} }
if (no_addr) if (no_addr)
...@@ -401,7 +401,7 @@ static int __fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst, ...@@ -401,7 +401,7 @@ static int __fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst,
ret = 0; ret = 0;
if (fib_lookup(net, &fl4, &res, FIB_LOOKUP_IGNORE_LINKSTATE) == 0) { if (fib_lookup(net, &fl4, &res, FIB_LOOKUP_IGNORE_LINKSTATE) == 0) {
if (res.type == RTN_UNICAST) 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; return ret;
......
...@@ -1231,7 +1231,7 @@ static int fib_check_nh_nongw(struct net *net, struct fib_nh *nh, ...@@ -1231,7 +1231,7 @@ static int fib_check_nh_nongw(struct net *net, struct fib_nh *nh,
nh->fib_nh_dev = in_dev->dev; nh->fib_nh_dev = in_dev->dev;
netdev_hold(nh->fib_nh_dev, &nh->fib_nh_dev_tracker, GFP_ATOMIC); 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)) if (!netif_carrier_ok(nh->fib_nh_dev))
nh->fib_nh_flags |= RTNH_F_LINKDOWN; nh->fib_nh_flags |= RTNH_F_LINKDOWN;
err = 0; err = 0;
......
...@@ -2534,7 +2534,7 @@ static int nh_create_ipv4(struct net *net, struct nexthop *nh, ...@@ -2534,7 +2534,7 @@ static int nh_create_ipv4(struct net *net, struct nexthop *nh,
if (!err) { if (!err) {
nh->nh_flags = fib_nh->fib_nh_flags; nh->nh_flags = fib_nh->fib_nh_flags;
fib_info_update_nhc_saddr(net, &fib_nh->nh_common, 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 { } else {
fib_nh_release(net, fib_nh); fib_nh_release(net, fib_nh);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment