diff options
author | Alexander Grund <flamefire89@gmail.com> | 2023-11-03 20:10:07 +0100 |
---|---|---|
committer | Alexander Grund <flamefire89@gmail.com> | 2023-11-09 19:28:44 +0100 |
commit | 30b450fc1cad48d881cb3163cb58ed31435e607d (patch) | |
tree | dd5f9fe2c604b47df75ef3f4fc1bc664d3a3a195 | |
parent | 7004494c34f64555fc265fac64d1bee111acf7f2 (diff) |
BACKPORT: net: ipv6: Fix processing of RAs in presence of VRF
commit 830218c1add1da16519b71909e5cf21522b7d062 upstream.
rt6_add_route_info and rt6_add_dflt_router were updated to pull the FIB
table from the device index, but the corresponding rt6_get_route_info
and rt6_get_dflt_router functions were not leading to the failure to
process RA's:
ICMPv6: RA: ndisc_router_discovery failed to add default route
Fix the 'get' functions by using the table id associated with the
device when applicable.
Backported to 4.4 after
6dd69fdc001f7e "net: ipv6: autoconf routes into per-device tables"
which caused the conflicts due to which this had initially been reverted.
Resolved conflicts:
- Signatures and call sites already use `struct net_device`
instead of `struct net` and `ifindex`
- The flag and the cleanup code using it are no longer required as
`fib6_clean_all` is used to iterate over all tables.
- `l3mdev_fib_table_by_index` replaced by `l3mdev_fib_table`
(prior incompletely resolved merge conflict)
- Use `RT6_TABLE_DFLT` instead of `RT6_TABLE_MAIN` in
`rt6_get_dflt_router` (similar prior conflict as above)
Fixes: ca254490c8dfd ("net: Add VRF support to IPv6 stack")
Fixes: 6dd69fdc001f7 ("net: ipv6: autoconf routes into per-device tables")
Change-Id: I9b95895f840c89dc989986d4c12f5d4cc077e047
-rw-r--r-- | net/ipv6/route.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index fd58f7feec8a..decb94219a70 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -2310,12 +2310,12 @@ static struct rt6_info *rt6_get_route_info(struct net_device *dev, const struct in6_addr *prefix, int prefixlen, const struct in6_addr *gwaddr) { + u32 tb_id = l3mdev_fib_table(dev) ? : addrconf_rt_table(dev, RT6_TABLE_INFO); struct fib6_node *fn; struct rt6_info *rt = NULL; struct fib6_table *table; - table = fib6_get_table(dev_net(dev), - addrconf_rt_table(dev, RT6_TABLE_INFO)); + table = fib6_get_table(dev_net(dev), tb_id); if (!table) return NULL; @@ -2354,7 +2354,7 @@ static struct rt6_info *rt6_add_route_info(struct net_device *dev, .fc_nlinfo.nl_net = dev_net(dev), }; - cfg.fc_table = l3mdev_fib_table_by_index(dev_net(dev), dev->ifindex) ? : addrconf_rt_table(dev, RT6_TABLE_INFO); + cfg.fc_table = l3mdev_fib_table(dev) ? : addrconf_rt_table(dev, RT6_TABLE_INFO); cfg.fc_dst = *prefix; cfg.fc_gateway = *gwaddr; @@ -2370,11 +2370,11 @@ static struct rt6_info *rt6_add_route_info(struct net_device *dev, struct rt6_info *rt6_get_dflt_router(const struct in6_addr *addr, struct net_device *dev) { + u32 tb_id = l3mdev_fib_table(dev) ? : addrconf_rt_table(dev, RT6_TABLE_DFLT); struct rt6_info *rt; struct fib6_table *table; - table = fib6_get_table(dev_net(dev), - addrconf_rt_table(dev, RT6_TABLE_MAIN)); + table = fib6_get_table(dev_net(dev), tb_id); if (!table) return NULL; |