Skip to content

Commit d55a2e3

Browse files
zenczykowskidavem330
authored andcommitted
net-ipv6: fix excessive RTF_ADDRCONF flag on ::1/128 local route (and others)
There is a subtle change in behaviour introduced by: commit c7a1ce3 '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: c7a1ce3 ("ipv6: Change addrconf_f6i_alloc to use ip6_route_info_create") Cc: David Ahern <[email protected]> Cc: Lorenzo Colitti <[email protected]> Signed-off-by: Maciej Żenczykowski <[email protected]> Reviewed-by: David Ahern <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 10eb56c commit d55a2e3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

net/ipv6/route.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4388,13 +4388,14 @@ struct fib6_info *addrconf_f6i_alloc(struct net *net,
43884388
struct fib6_config cfg = {
43894389
.fc_table = l3mdev_fib_table(idev->dev) ? : RT6_TABLE_LOCAL,
43904390
.fc_ifindex = idev->dev->ifindex,
4391-
.fc_flags = RTF_UP | RTF_ADDRCONF | RTF_NONEXTHOP,
4391+
.fc_flags = RTF_UP | RTF_NONEXTHOP,
43924392
.fc_dst = *addr,
43934393
.fc_dst_len = 128,
43944394
.fc_protocol = RTPROT_KERNEL,
43954395
.fc_nlinfo.nl_net = net,
43964396
.fc_ignore_dev_down = true,
43974397
};
4398+
struct fib6_info *f6i;
43984399

43994400
if (anycast) {
44004401
cfg.fc_type = RTN_ANYCAST;
@@ -4404,7 +4405,10 @@ struct fib6_info *addrconf_f6i_alloc(struct net *net,
44044405
cfg.fc_flags |= RTF_LOCAL;
44054406
}
44064407

4407-
return ip6_route_info_create(&cfg, gfp_flags, NULL);
4408+
f6i = ip6_route_info_create(&cfg, gfp_flags, NULL);
4409+
if (f6i)
4410+
f6i->dst_nocount = true;
4411+
return f6i;
44084412
}
44094413

44104414
/* remove deleted ip from prefsrc entries */

0 commit comments

Comments
 (0)