Message ID | 20190902162336.240405-1-zenczykowski@gmail.com |
---|---|
State | Accepted |
Delegated to: | David Miller |
Headers | show |
Series | [v2] net-ipv6: fix excessive RTF_ADDRCONF flag on ::1/128 local route (and others) | expand |
On 9/2/19 10:23 AM, Maciej Żenczykowski wrote: > From: Maciej Żenczykowski <maze@google.com> > > There is a subtle change in behaviour introduced by: > commit c7a1ce397adacaf5d4bb2eab0a738b5f80dc3e43 > 'ipv6: Change addrconf_f6i_alloc to use ip6_route_info_create' > > Before that patch /proc/net/ipv6_route includes: > 00000000000000000000000000000001 80 00000000000000000000000000000000 00 00000000000000000000000000000000 00000000 00000003 00000000 80200001 lo > > Afterwards /proc/net/ipv6_route includes: > 00000000000000000000000000000001 80 00000000000000000000000000000000 00 00000000000000000000000000000000 00000000 00000002 00000000 80240001 lo > > ie. the above commit causes the ::1/128 local (automatic) route to be flagged with RTF_ADDRCONF (0x040000). > > AFAICT, this is incorrect since these routes are *not* coming from RA's. > > As such, this patch restores the old behaviour. > > Fixes: c7a1ce397adacaf5d4bb2eab0a738b5f80dc3e43 > Cc: David Ahern <dsahern@gmail.com> > Cc: Lorenzo Colitti <lorenzo@google.com> > Signed-off-by: Maciej Żenczykowski <maze@google.com> > --- > net/ipv6/route.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > Looks correct to me. Thanks for the patch. Reviewed-by: David Ahern <dsahern@gmail.com>
From: Maciej Żenczykowski <zenczykowski@gmail.com> Date: Mon, 2 Sep 2019 09:23:36 -0700 > From: Maciej Żenczykowski <maze@google.com> > > There is a subtle change in behaviour introduced by: > commit c7a1ce397adacaf5d4bb2eab0a738b5f80dc3e43 > 'ipv6: Change addrconf_f6i_alloc to use ip6_route_info_create' > > Before that patch /proc/net/ipv6_route includes: > 00000000000000000000000000000001 80 00000000000000000000000000000000 00 00000000000000000000000000000000 00000000 00000003 00000000 80200001 lo > > Afterwards /proc/net/ipv6_route includes: > 00000000000000000000000000000001 80 00000000000000000000000000000000 00 00000000000000000000000000000000 00000000 00000002 00000000 80240001 lo > > ie. the above commit causes the ::1/128 local (automatic) route to be flagged with RTF_ADDRCONF (0x040000). > > AFAICT, this is incorrect since these routes are *not* coming from RA's. > > As such, this patch restores the old behaviour. > > Fixes: c7a1ce397adacaf5d4bb2eab0a738b5f80dc3e43 Please format your Fixes: tag properly next time, I fixed it up for you. > Cc: David Ahern <dsahern@gmail.com> > Cc: Lorenzo Colitti <lorenzo@google.com> > Signed-off-by: Maciej Żenczykowski <maze@google.com> Applied and queued up for -stable.
On 9/2/19 6:23 PM, Maciej Żenczykowski wrote: > From: Maciej Żenczykowski <maze@google.com> > > There is a subtle change in behaviour introduced by: > commit c7a1ce397adacaf5d4bb2eab0a738b5f80dc3e43 > 'ipv6: Change addrconf_f6i_alloc to use ip6_route_info_create' > > Before that patch /proc/net/ipv6_route includes: > 00000000000000000000000000000001 80 00000000000000000000000000000000 00 00000000000000000000000000000000 00000000 00000003 00000000 80200001 lo > > Afterwards /proc/net/ipv6_route includes: > 00000000000000000000000000000001 80 00000000000000000000000000000000 00 00000000000000000000000000000000 00000000 00000002 00000000 80240001 lo > > ie. the above commit causes the ::1/128 local (automatic) route to be flagged with RTF_ADDRCONF (0x040000). > > AFAICT, this is incorrect since these routes are *not* coming from RA's. > > As such, this patch restores the old behaviour. > > Fixes: c7a1ce397adacaf5d4bb2eab0a738b5f80dc3e43 > Cc: David Ahern <dsahern@gmail.com> > Cc: Lorenzo Colitti <lorenzo@google.com> > Signed-off-by: Maciej Żenczykowski <maze@google.com> > --- > net/ipv6/route.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/net/ipv6/route.c b/net/ipv6/route.c > index 558c6c68855f..516b2e568dae 100644 > --- a/net/ipv6/route.c > +++ b/net/ipv6/route.c > @@ -4365,13 +4365,14 @@ struct fib6_info *addrconf_f6i_alloc(struct net *net, > struct fib6_config cfg = { > .fc_table = l3mdev_fib_table(idev->dev) ? : RT6_TABLE_LOCAL, > .fc_ifindex = idev->dev->ifindex, > - .fc_flags = RTF_UP | RTF_ADDRCONF | RTF_NONEXTHOP, > + .fc_flags = RTF_UP | RTF_NONEXTHOP, > .fc_dst = *addr, > .fc_dst_len = 128, > .fc_protocol = RTPROT_KERNEL, > .fc_nlinfo.nl_net = net, > .fc_ignore_dev_down = true, > }; > + struct fib6_info *f6i; > > if (anycast) { > cfg.fc_type = RTN_ANYCAST; > @@ -4381,7 +4382,10 @@ struct fib6_info *addrconf_f6i_alloc(struct net *net, > cfg.fc_flags |= RTF_LOCAL; > } > > - return ip6_route_info_create(&cfg, gfp_flags, NULL); > + f6i = ip6_route_info_create(&cfg, gfp_flags, NULL); > + if (f6i) > + f6i->dst_nocount = true; Shouldn't it use if (!IS_ERR(f6i)) f6i->dst_nocount = true; ??? > + return f6i; > } > > /* remove deleted ip from prefsrc entries */ >
> Shouldn't it use > > if (!IS_ERR(f6i)) > f6i->dst_nocount = true; > > ??? Yes, certainly. I'll send a fix.
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 558c6c68855f..516b2e568dae 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -4365,13 +4365,14 @@ struct fib6_info *addrconf_f6i_alloc(struct net *net, struct fib6_config cfg = { .fc_table = l3mdev_fib_table(idev->dev) ? : RT6_TABLE_LOCAL, .fc_ifindex = idev->dev->ifindex, - .fc_flags = RTF_UP | RTF_ADDRCONF | RTF_NONEXTHOP, + .fc_flags = RTF_UP | RTF_NONEXTHOP, .fc_dst = *addr, .fc_dst_len = 128, .fc_protocol = RTPROT_KERNEL, .fc_nlinfo.nl_net = net, .fc_ignore_dev_down = true, }; + struct fib6_info *f6i; if (anycast) { cfg.fc_type = RTN_ANYCAST; @@ -4381,7 +4382,10 @@ struct fib6_info *addrconf_f6i_alloc(struct net *net, cfg.fc_flags |= RTF_LOCAL; } - return ip6_route_info_create(&cfg, gfp_flags, NULL); + f6i = ip6_route_info_create(&cfg, gfp_flags, NULL); + if (f6i) + f6i->dst_nocount = true; + return f6i; } /* remove deleted ip from prefsrc entries */