提交 9cbb7ecb 编写于 作者: D David S. Miller

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: NDavid S. Miller <davem@davemloft.net>
上级 8f40b161
...@@ -87,7 +87,6 @@ struct rt6_info { ...@@ -87,7 +87,6 @@ struct rt6_info {
struct dst_entry dst; struct dst_entry dst;
#define rt6i_dev dst.dev #define rt6i_dev dst.dev
#define rt6i_nexthop dst.neighbour
#define rt6i_expires dst.expires #define rt6i_expires dst.expires
/* /*
......
...@@ -656,7 +656,7 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, int pfxlen, ...@@ -656,7 +656,7 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, int pfxlen,
* layer address of our nexhop router * layer address of our nexhop router
*/ */
if (rt->rt6i_nexthop == NULL) if (rt->dst.neighbour == NULL)
ifa->flags &= ~IFA_F_OPTIMISTIC; ifa->flags &= ~IFA_F_OPTIMISTIC;
ifa->idev = idev; ifa->idev = idev;
......
...@@ -1455,7 +1455,7 @@ static int fib6_age(struct rt6_info *rt, void *arg) ...@@ -1455,7 +1455,7 @@ static int fib6_age(struct rt6_info *rt, void *arg)
RT6_TRACE("aging clone %p\n", rt); RT6_TRACE("aging clone %p\n", rt);
return -1; return -1;
} else if ((rt->rt6i_flags & RTF_GATEWAY) && } else if ((rt->rt6i_flags & RTF_GATEWAY) &&
(!(rt->rt6i_nexthop->flags & NTF_ROUTER))) { (!(rt->dst.neighbour->flags & NTF_ROUTER))) {
RT6_TRACE("purging route %p via non-router but gateway\n", RT6_TRACE("purging route %p via non-router but gateway\n",
rt); rt);
return -1; return -1;
......
...@@ -1238,7 +1238,7 @@ static void ndisc_router_discovery(struct sk_buff *skb) ...@@ -1238,7 +1238,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
rt = rt6_get_dflt_router(&ipv6_hdr(skb)->saddr, skb->dev); rt = rt6_get_dflt_router(&ipv6_hdr(skb)->saddr, skb->dev);
if (rt) if (rt)
neigh = rt->rt6i_nexthop; neigh = rt->dst.neighbour;
if (rt && lifetime == 0) { if (rt && lifetime == 0) {
neigh_clone(neigh); neigh_clone(neigh);
...@@ -1259,7 +1259,7 @@ static void ndisc_router_discovery(struct sk_buff *skb) ...@@ -1259,7 +1259,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
return; return;
} }
neigh = rt->rt6i_nexthop; neigh = rt->dst.neighbour;
if (neigh == NULL) { if (neigh == NULL) {
ND_PRINTK0(KERN_ERR ND_PRINTK0(KERN_ERR
"ICMPv6 RA: %s() got default router without neighbour.\n", "ICMPv6 RA: %s() got default router without neighbour.\n",
......
...@@ -356,7 +356,7 @@ static inline struct rt6_info *rt6_device_match(struct net *net, ...@@ -356,7 +356,7 @@ static inline struct rt6_info *rt6_device_match(struct net *net,
#ifdef CONFIG_IPV6_ROUTER_PREF #ifdef CONFIG_IPV6_ROUTER_PREF
static void rt6_probe(struct rt6_info *rt) static void rt6_probe(struct rt6_info *rt)
{ {
struct neighbour *neigh = rt ? rt->rt6i_nexthop : NULL; struct neighbour *neigh = rt ? rt->dst.neighbour : NULL;
/* /*
* Okay, this does not seem to be appropriate * Okay, this does not seem to be appropriate
* for now, however, we need to check if it * for now, however, we need to check if it
...@@ -404,7 +404,7 @@ static inline int rt6_check_dev(struct rt6_info *rt, int oif) ...@@ -404,7 +404,7 @@ static inline int rt6_check_dev(struct rt6_info *rt, int oif)
static inline int rt6_check_neigh(struct rt6_info *rt) static inline int rt6_check_neigh(struct rt6_info *rt)
{ {
struct neighbour *neigh = rt->rt6i_nexthop; struct neighbour *neigh = rt->dst.neighbour;
int m; int m;
if (rt->rt6i_flags & RTF_NONEXTHOP || if (rt->rt6i_flags & RTF_NONEXTHOP ||
!(rt->rt6i_flags & RTF_GATEWAY)) !(rt->rt6i_flags & RTF_GATEWAY))
...@@ -745,7 +745,7 @@ static struct rt6_info *rt6_alloc_cow(struct rt6_info *ort, const struct in6_add ...@@ -745,7 +745,7 @@ static struct rt6_info *rt6_alloc_cow(struct rt6_info *ort, const struct in6_add
dst_free(&rt->dst); dst_free(&rt->dst);
return NULL; return NULL;
} }
rt->rt6i_nexthop = neigh; rt->dst.neighbour = neigh;
} }
...@@ -760,7 +760,7 @@ static struct rt6_info *rt6_alloc_clone(struct rt6_info *ort, const struct in6_a ...@@ -760,7 +760,7 @@ static struct rt6_info *rt6_alloc_clone(struct rt6_info *ort, const struct in6_a
rt->rt6i_dst.plen = 128; rt->rt6i_dst.plen = 128;
rt->rt6i_flags |= RTF_CACHE; rt->rt6i_flags |= RTF_CACHE;
rt->dst.flags |= DST_HOST; rt->dst.flags |= DST_HOST;
rt->rt6i_nexthop = neigh_clone(ort->rt6i_nexthop); rt->dst.neighbour = neigh_clone(ort->dst.neighbour);
} }
return rt; return rt;
} }
...@@ -794,7 +794,7 @@ static struct rt6_info *ip6_pol_route(struct net *net, struct fib6_table *table, ...@@ -794,7 +794,7 @@ static struct rt6_info *ip6_pol_route(struct net *net, struct fib6_table *table,
dst_hold(&rt->dst); dst_hold(&rt->dst);
read_unlock_bh(&table->tb6_lock); read_unlock_bh(&table->tb6_lock);
if (!rt->rt6i_nexthop && !(rt->rt6i_flags & RTF_NONEXTHOP)) if (!rt->dst.neighbour && !(rt->rt6i_flags & RTF_NONEXTHOP))
nrt = rt6_alloc_cow(rt, &fl6->daddr, &fl6->saddr); nrt = rt6_alloc_cow(rt, &fl6->daddr, &fl6->saddr);
else if (!(rt->dst.flags & DST_HOST)) else if (!(rt->dst.flags & DST_HOST))
nrt = rt6_alloc_clone(rt, &fl6->daddr); nrt = rt6_alloc_clone(rt, &fl6->daddr);
...@@ -1058,7 +1058,7 @@ struct dst_entry *icmp6_dst_alloc(struct net_device *dev, ...@@ -1058,7 +1058,7 @@ struct dst_entry *icmp6_dst_alloc(struct net_device *dev,
} }
rt->rt6i_idev = idev; rt->rt6i_idev = idev;
rt->rt6i_nexthop = neigh; rt->dst.neighbour = neigh;
atomic_set(&rt->dst.__refcnt, 1); atomic_set(&rt->dst.__refcnt, 1);
dst_metric_set(&rt->dst, RTAX_HOPLIMIT, 255); dst_metric_set(&rt->dst, RTAX_HOPLIMIT, 255);
rt->dst.output = ip6_output; rt->dst.output = ip6_output;
...@@ -1338,10 +1338,10 @@ int ip6_route_add(struct fib6_config *cfg) ...@@ -1338,10 +1338,10 @@ int ip6_route_add(struct fib6_config *cfg)
rt->rt6i_prefsrc.plen = 0; rt->rt6i_prefsrc.plen = 0;
if (cfg->fc_flags & (RTF_GATEWAY | RTF_NONEXTHOP)) { if (cfg->fc_flags & (RTF_GATEWAY | RTF_NONEXTHOP)) {
rt->rt6i_nexthop = __neigh_lookup_errno(&nd_tbl, &rt->rt6i_gateway, dev); rt->dst.neighbour = __neigh_lookup_errno(&nd_tbl, &rt->rt6i_gateway, dev);
if (IS_ERR(rt->rt6i_nexthop)) { if (IS_ERR(rt->dst.neighbour)) {
err = PTR_ERR(rt->rt6i_nexthop); err = PTR_ERR(rt->dst.neighbour);
rt->rt6i_nexthop = NULL; rt->dst.neighbour = NULL;
goto out; goto out;
} }
} }
...@@ -1590,7 +1590,7 @@ void rt6_redirect(const struct in6_addr *dest, const struct in6_addr *src, ...@@ -1590,7 +1590,7 @@ void rt6_redirect(const struct in6_addr *dest, const struct in6_addr *src,
nrt->dst.flags |= DST_HOST; nrt->dst.flags |= DST_HOST;
ipv6_addr_copy(&nrt->rt6i_gateway, (struct in6_addr*)neigh->primary_key); ipv6_addr_copy(&nrt->rt6i_gateway, (struct in6_addr*)neigh->primary_key);
nrt->rt6i_nexthop = neigh_clone(neigh); nrt->dst.neighbour = neigh_clone(neigh);
if (ip6_ins_rt(nrt)) if (ip6_ins_rt(nrt))
goto out; goto out;
...@@ -1670,7 +1670,7 @@ static void rt6_do_pmtu_disc(const struct in6_addr *daddr, const struct in6_addr ...@@ -1670,7 +1670,7 @@ static void rt6_do_pmtu_disc(const struct in6_addr *daddr, const struct in6_addr
1. It is connected route. Action: COW 1. It is connected route. Action: COW
2. It is gatewayed route or NONEXTHOP route. Action: clone it. 2. It is gatewayed route or NONEXTHOP route. Action: clone it.
*/ */
if (!rt->rt6i_nexthop && !(rt->rt6i_flags & RTF_NONEXTHOP)) if (!rt->dst.neighbour && !(rt->rt6i_flags & RTF_NONEXTHOP))
nrt = rt6_alloc_cow(rt, daddr, saddr); nrt = rt6_alloc_cow(rt, daddr, saddr);
else else
nrt = rt6_alloc_clone(rt, daddr); nrt = rt6_alloc_clone(rt, daddr);
...@@ -2035,7 +2035,7 @@ struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev, ...@@ -2035,7 +2035,7 @@ struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev,
return ERR_CAST(neigh); return ERR_CAST(neigh);
} }
rt->rt6i_nexthop = neigh; rt->dst.neighbour = neigh;
ipv6_addr_copy(&rt->rt6i_dst.addr, addr); ipv6_addr_copy(&rt->rt6i_dst.addr, addr);
rt->rt6i_dst.plen = 128; rt->rt6i_dst.plen = 128;
...@@ -2594,8 +2594,8 @@ static int rt6_info_route(struct rt6_info *rt, void *p_arg) ...@@ -2594,8 +2594,8 @@ static int rt6_info_route(struct rt6_info *rt, void *p_arg)
seq_puts(m, "00000000000000000000000000000000 00 "); seq_puts(m, "00000000000000000000000000000000 00 ");
#endif #endif
if (rt->rt6i_nexthop) { if (rt->dst.neighbour) {
seq_printf(m, "%pi6", rt->rt6i_nexthop->primary_key); seq_printf(m, "%pi6", rt->dst.neighbour->primary_key);
} else { } else {
seq_puts(m, "00000000000000000000000000000000"); seq_puts(m, "00000000000000000000000000000000");
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册