aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-07-18 02:09:49 -0400
committerDavid S. Miller <davem@davemloft.net>2011-07-18 02:11:35 -0400
commit69cce1d1404968f78b177a0314f5822d5afdbbfb (patch)
tree26223264fd69ea8078d0013fd5a76eb7aeb04c12 /net/core
parent9cbb7ecbcff85077bb12301aaf4c9b5a56c5993d (diff)
net: Abstract dst->neighbour accesses behind helpers.
dst_{get,set}_neighbour() Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/dst.c10
-rw-r--r--net/core/neighbour.c7
2 files changed, 9 insertions, 8 deletions
diff --git a/net/core/dst.c b/net/core/dst.c
index 4aacc14936a0..14b33baf0733 100644
--- a/net/core/dst.c
+++ b/net/core/dst.c
@@ -171,7 +171,7 @@ void *dst_alloc(struct dst_ops *ops, struct net_device *dev,
171 dst_init_metrics(dst, dst_default_metrics, true); 171 dst_init_metrics(dst, dst_default_metrics, true);
172 dst->expires = 0UL; 172 dst->expires = 0UL;
173 dst->path = dst; 173 dst->path = dst;
174 dst->neighbour = NULL; 174 dst->_neighbour = NULL;
175#ifdef CONFIG_XFRM 175#ifdef CONFIG_XFRM
176 dst->xfrm = NULL; 176 dst->xfrm = NULL;
177#endif 177#endif
@@ -229,11 +229,11 @@ struct dst_entry *dst_destroy(struct dst_entry * dst)
229 smp_rmb(); 229 smp_rmb();
230 230
231again: 231again:
232 neigh = dst->neighbour; 232 neigh = dst->_neighbour;
233 child = dst->child; 233 child = dst->child;
234 234
235 if (neigh) { 235 if (neigh) {
236 dst->neighbour = NULL; 236 dst->_neighbour = NULL;
237 neigh_release(neigh); 237 neigh_release(neigh);
238 } 238 }
239 239
@@ -363,8 +363,8 @@ static void dst_ifdown(struct dst_entry *dst, struct net_device *dev,
363 dst->dev = dev_net(dst->dev)->loopback_dev; 363 dst->dev = dev_net(dst->dev)->loopback_dev;
364 dev_hold(dst->dev); 364 dev_hold(dst->dev);
365 dev_put(dev); 365 dev_put(dev);
366 if (dst->neighbour && dst->neighbour->dev == dev) { 366 if (dst->_neighbour && dst->_neighbour->dev == dev) {
367 dst->neighbour->dev = dst->dev; 367 dst->_neighbour->dev = dst->dev;
368 dev_hold(dst->dev); 368 dev_hold(dst->dev);
369 dev_put(dev); 369 dev_put(dev);
370 } 370 }
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index cefb8e52615e..8fab9b0bb203 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -1153,11 +1153,12 @@ int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new,
1153 1153
1154 while (neigh->nud_state & NUD_VALID && 1154 while (neigh->nud_state & NUD_VALID &&
1155 (skb = __skb_dequeue(&neigh->arp_queue)) != NULL) { 1155 (skb = __skb_dequeue(&neigh->arp_queue)) != NULL) {
1156 struct neighbour *n1 = neigh; 1156 struct dst_entry *dst = skb_dst(skb);
1157 struct neighbour *n2, *n1 = neigh;
1157 write_unlock_bh(&neigh->lock); 1158 write_unlock_bh(&neigh->lock);
1158 /* On shaper/eql skb->dst->neighbour != neigh :( */ 1159 /* On shaper/eql skb->dst->neighbour != neigh :( */
1159 if (skb_dst(skb) && skb_dst(skb)->neighbour) 1160 if (dst && (n2 = dst_get_neighbour(dst)) != NULL)
1160 n1 = skb_dst(skb)->neighbour; 1161 n1 = n2;
1161 n1->output(n1, skb); 1162 n1->output(n1, skb);
1162 write_lock_bh(&neigh->lock); 1163 write_lock_bh(&neigh->lock);
1163 } 1164 }