Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ipv6: Get rid of rt6i_nexthop macro.

It just makes it harder to see 1) what the code is doing
and 2) grep for all users of dst{->,.}neighbour

Signed-off-by: David S. Miller <davem@davemloft.net>

+19 -20
-1
include/net/ip6_fib.h
··· 87 87 struct dst_entry dst; 88 88 89 89 #define rt6i_dev dst.dev 90 - #define rt6i_nexthop dst.neighbour 91 90 #define rt6i_expires dst.expires 92 91 93 92 /*
+1 -1
net/ipv6/addrconf.c
··· 656 656 * layer address of our nexhop router 657 657 */ 658 658 659 - if (rt->rt6i_nexthop == NULL) 659 + if (rt->dst.neighbour == NULL) 660 660 ifa->flags &= ~IFA_F_OPTIMISTIC; 661 661 662 662 ifa->idev = idev;
+1 -1
net/ipv6/ip6_fib.c
··· 1455 1455 RT6_TRACE("aging clone %p\n", rt); 1456 1456 return -1; 1457 1457 } else if ((rt->rt6i_flags & RTF_GATEWAY) && 1458 - (!(rt->rt6i_nexthop->flags & NTF_ROUTER))) { 1458 + (!(rt->dst.neighbour->flags & NTF_ROUTER))) { 1459 1459 RT6_TRACE("purging route %p via non-router but gateway\n", 1460 1460 rt); 1461 1461 return -1;
+2 -2
net/ipv6/ndisc.c
··· 1238 1238 rt = rt6_get_dflt_router(&ipv6_hdr(skb)->saddr, skb->dev); 1239 1239 1240 1240 if (rt) 1241 - neigh = rt->rt6i_nexthop; 1241 + neigh = rt->dst.neighbour; 1242 1242 1243 1243 if (rt && lifetime == 0) { 1244 1244 neigh_clone(neigh); ··· 1259 1259 return; 1260 1260 } 1261 1261 1262 - neigh = rt->rt6i_nexthop; 1262 + neigh = rt->dst.neighbour; 1263 1263 if (neigh == NULL) { 1264 1264 ND_PRINTK0(KERN_ERR 1265 1265 "ICMPv6 RA: %s() got default router without neighbour.\n",
+15 -15
net/ipv6/route.c
··· 356 356 #ifdef CONFIG_IPV6_ROUTER_PREF 357 357 static void rt6_probe(struct rt6_info *rt) 358 358 { 359 - struct neighbour *neigh = rt ? rt->rt6i_nexthop : NULL; 359 + struct neighbour *neigh = rt ? rt->dst.neighbour : NULL; 360 360 /* 361 361 * Okay, this does not seem to be appropriate 362 362 * for now, however, we need to check if it ··· 404 404 405 405 static inline int rt6_check_neigh(struct rt6_info *rt) 406 406 { 407 - struct neighbour *neigh = rt->rt6i_nexthop; 407 + struct neighbour *neigh = rt->dst.neighbour; 408 408 int m; 409 409 if (rt->rt6i_flags & RTF_NONEXTHOP || 410 410 !(rt->rt6i_flags & RTF_GATEWAY)) ··· 745 745 dst_free(&rt->dst); 746 746 return NULL; 747 747 } 748 - rt->rt6i_nexthop = neigh; 748 + rt->dst.neighbour = neigh; 749 749 750 750 } 751 751 ··· 760 760 rt->rt6i_dst.plen = 128; 761 761 rt->rt6i_flags |= RTF_CACHE; 762 762 rt->dst.flags |= DST_HOST; 763 - rt->rt6i_nexthop = neigh_clone(ort->rt6i_nexthop); 763 + rt->dst.neighbour = neigh_clone(ort->dst.neighbour); 764 764 } 765 765 return rt; 766 766 } ··· 794 794 dst_hold(&rt->dst); 795 795 read_unlock_bh(&table->tb6_lock); 796 796 797 - if (!rt->rt6i_nexthop && !(rt->rt6i_flags & RTF_NONEXTHOP)) 797 + if (!rt->dst.neighbour && !(rt->rt6i_flags & RTF_NONEXTHOP)) 798 798 nrt = rt6_alloc_cow(rt, &fl6->daddr, &fl6->saddr); 799 799 else if (!(rt->dst.flags & DST_HOST)) 800 800 nrt = rt6_alloc_clone(rt, &fl6->daddr); ··· 1058 1058 } 1059 1059 1060 1060 rt->rt6i_idev = idev; 1061 - rt->rt6i_nexthop = neigh; 1061 + rt->dst.neighbour = neigh; 1062 1062 atomic_set(&rt->dst.__refcnt, 1); 1063 1063 dst_metric_set(&rt->dst, RTAX_HOPLIMIT, 255); 1064 1064 rt->dst.output = ip6_output; ··· 1338 1338 rt->rt6i_prefsrc.plen = 0; 1339 1339 1340 1340 if (cfg->fc_flags & (RTF_GATEWAY | RTF_NONEXTHOP)) { 1341 - rt->rt6i_nexthop = __neigh_lookup_errno(&nd_tbl, &rt->rt6i_gateway, dev); 1342 - if (IS_ERR(rt->rt6i_nexthop)) { 1343 - err = PTR_ERR(rt->rt6i_nexthop); 1344 - rt->rt6i_nexthop = NULL; 1341 + rt->dst.neighbour = __neigh_lookup_errno(&nd_tbl, &rt->rt6i_gateway, dev); 1342 + if (IS_ERR(rt->dst.neighbour)) { 1343 + err = PTR_ERR(rt->dst.neighbour); 1344 + rt->dst.neighbour = NULL; 1345 1345 goto out; 1346 1346 } 1347 1347 } ··· 1590 1590 nrt->dst.flags |= DST_HOST; 1591 1591 1592 1592 ipv6_addr_copy(&nrt->rt6i_gateway, (struct in6_addr*)neigh->primary_key); 1593 - nrt->rt6i_nexthop = neigh_clone(neigh); 1593 + nrt->dst.neighbour = neigh_clone(neigh); 1594 1594 1595 1595 if (ip6_ins_rt(nrt)) 1596 1596 goto out; ··· 1670 1670 1. It is connected route. Action: COW 1671 1671 2. It is gatewayed route or NONEXTHOP route. Action: clone it. 1672 1672 */ 1673 - if (!rt->rt6i_nexthop && !(rt->rt6i_flags & RTF_NONEXTHOP)) 1673 + if (!rt->dst.neighbour && !(rt->rt6i_flags & RTF_NONEXTHOP)) 1674 1674 nrt = rt6_alloc_cow(rt, daddr, saddr); 1675 1675 else 1676 1676 nrt = rt6_alloc_clone(rt, daddr); ··· 2035 2035 2036 2036 return ERR_CAST(neigh); 2037 2037 } 2038 - rt->rt6i_nexthop = neigh; 2038 + rt->dst.neighbour = neigh; 2039 2039 2040 2040 ipv6_addr_copy(&rt->rt6i_dst.addr, addr); 2041 2041 rt->rt6i_dst.plen = 128; ··· 2594 2594 seq_puts(m, "00000000000000000000000000000000 00 "); 2595 2595 #endif 2596 2596 2597 - if (rt->rt6i_nexthop) { 2598 - seq_printf(m, "%pi6", rt->rt6i_nexthop->primary_key); 2597 + if (rt->dst.neighbour) { 2598 + seq_printf(m, "%pi6", rt->dst.neighbour->primary_key); 2599 2599 } else { 2600 2600 seq_puts(m, "00000000000000000000000000000000"); 2601 2601 }