diff options
author | David S. Miller <davem@davemloft.net> | 2011-07-17 16:34:11 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-07-18 02:11:17 -0400 |
commit | 8f40b161de4f27402b4c0659ad2ae83fad5a0cdd (patch) | |
tree | 9e2dbd4ba8a66916c690b0e5791ac25ea0958c26 /net/decnet | |
parent | 69ecca86da4890c13a5e29c51b4ac76a1a8a62c9 (diff) |
neigh: Pass neighbour entry to output ops.
This will get us closer to being able to do "neigh stuff"
completely independent of the underlying dst_entry for
protocols (ipv4/ipv6) that wish to do so.
We will also be able to make dst entries neigh-less.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/decnet')
-rw-r--r-- | net/decnet/dn_neigh.c | 18 | ||||
-rw-r--r-- | net/decnet/dn_route.c | 13 |
2 files changed, 16 insertions, 15 deletions
diff --git a/net/decnet/dn_neigh.c b/net/decnet/dn_neigh.c index 84fee8a4f89d..5d61e8965b66 100644 --- a/net/decnet/dn_neigh.c +++ b/net/decnet/dn_neigh.c | |||
@@ -51,9 +51,9 @@ | |||
51 | static int dn_neigh_construct(struct neighbour *); | 51 | static int dn_neigh_construct(struct neighbour *); |
52 | static void dn_long_error_report(struct neighbour *, struct sk_buff *); | 52 | static void dn_long_error_report(struct neighbour *, struct sk_buff *); |
53 | static void dn_short_error_report(struct neighbour *, struct sk_buff *); | 53 | static void dn_short_error_report(struct neighbour *, struct sk_buff *); |
54 | static int dn_long_output(struct sk_buff *); | 54 | static int dn_long_output(struct neighbour *, struct sk_buff *); |
55 | static int dn_short_output(struct sk_buff *); | 55 | static int dn_short_output(struct neighbour *, struct sk_buff *); |
56 | static int dn_phase3_output(struct sk_buff *); | 56 | static int dn_phase3_output(struct neighbour *, struct sk_buff *); |
57 | 57 | ||
58 | 58 | ||
59 | /* | 59 | /* |
@@ -218,10 +218,8 @@ static int dn_neigh_output_packet(struct sk_buff *skb) | |||
218 | return -EINVAL; | 218 | return -EINVAL; |
219 | } | 219 | } |
220 | 220 | ||
221 | static int dn_long_output(struct sk_buff *skb) | 221 | static int dn_long_output(struct neighbour *neigh, struct sk_buff *skb) |
222 | { | 222 | { |
223 | struct dst_entry *dst = skb_dst(skb); | ||
224 | struct neighbour *neigh = dst->neighbour; | ||
225 | struct net_device *dev = neigh->dev; | 223 | struct net_device *dev = neigh->dev; |
226 | int headroom = dev->hard_header_len + sizeof(struct dn_long_packet) + 3; | 224 | int headroom = dev->hard_header_len + sizeof(struct dn_long_packet) + 3; |
227 | unsigned char *data; | 225 | unsigned char *data; |
@@ -265,10 +263,8 @@ static int dn_long_output(struct sk_buff *skb) | |||
265 | neigh->dev, dn_neigh_output_packet); | 263 | neigh->dev, dn_neigh_output_packet); |
266 | } | 264 | } |
267 | 265 | ||
268 | static int dn_short_output(struct sk_buff *skb) | 266 | static int dn_short_output(struct neighbour *neigh, struct sk_buff *skb) |
269 | { | 267 | { |
270 | struct dst_entry *dst = skb_dst(skb); | ||
271 | struct neighbour *neigh = dst->neighbour; | ||
272 | struct net_device *dev = neigh->dev; | 268 | struct net_device *dev = neigh->dev; |
273 | int headroom = dev->hard_header_len + sizeof(struct dn_short_packet) + 2; | 269 | int headroom = dev->hard_header_len + sizeof(struct dn_short_packet) + 2; |
274 | struct dn_short_packet *sp; | 270 | struct dn_short_packet *sp; |
@@ -309,10 +305,8 @@ static int dn_short_output(struct sk_buff *skb) | |||
309 | * Phase 3 output is the same is short output, execpt that | 305 | * Phase 3 output is the same is short output, execpt that |
310 | * it clears the area bits before transmission. | 306 | * it clears the area bits before transmission. |
311 | */ | 307 | */ |
312 | static int dn_phase3_output(struct sk_buff *skb) | 308 | static int dn_phase3_output(struct neighbour *neigh, struct sk_buff *skb) |
313 | { | 309 | { |
314 | struct dst_entry *dst = skb_dst(skb); | ||
315 | struct neighbour *neigh = dst->neighbour; | ||
316 | struct net_device *dev = neigh->dev; | 310 | struct net_device *dev = neigh->dev; |
317 | int headroom = dev->hard_header_len + sizeof(struct dn_short_packet) + 2; | 311 | int headroom = dev->hard_header_len + sizeof(struct dn_short_packet) + 2; |
318 | struct dn_short_packet *sp; | 312 | struct dn_short_packet *sp; |
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c index fceb86ca0116..3b6400d17dc2 100644 --- a/net/decnet/dn_route.c +++ b/net/decnet/dn_route.c | |||
@@ -705,6 +705,14 @@ out: | |||
705 | return NET_RX_DROP; | 705 | return NET_RX_DROP; |
706 | } | 706 | } |
707 | 707 | ||
708 | static int dn_to_neigh_output(struct sk_buff *skb) | ||
709 | { | ||
710 | struct dst_entry *dst = skb_dst(skb); | ||
711 | struct neighbour *n = dst->neighbour; | ||
712 | |||
713 | return n->output(n, skb); | ||
714 | } | ||
715 | |||
708 | static int dn_output(struct sk_buff *skb) | 716 | static int dn_output(struct sk_buff *skb) |
709 | { | 717 | { |
710 | struct dst_entry *dst = skb_dst(skb); | 718 | struct dst_entry *dst = skb_dst(skb); |
@@ -733,7 +741,7 @@ static int dn_output(struct sk_buff *skb) | |||
733 | cb->hops = 0; | 741 | cb->hops = 0; |
734 | 742 | ||
735 | return NF_HOOK(NFPROTO_DECNET, NF_DN_LOCAL_OUT, skb, NULL, dev, | 743 | return NF_HOOK(NFPROTO_DECNET, NF_DN_LOCAL_OUT, skb, NULL, dev, |
736 | neigh->output); | 744 | dn_to_neigh_output); |
737 | 745 | ||
738 | error: | 746 | error: |
739 | if (net_ratelimit()) | 747 | if (net_ratelimit()) |
@@ -750,7 +758,6 @@ static int dn_forward(struct sk_buff *skb) | |||
750 | struct dst_entry *dst = skb_dst(skb); | 758 | struct dst_entry *dst = skb_dst(skb); |
751 | struct dn_dev *dn_db = rcu_dereference(dst->dev->dn_ptr); | 759 | struct dn_dev *dn_db = rcu_dereference(dst->dev->dn_ptr); |
752 | struct dn_route *rt; | 760 | struct dn_route *rt; |
753 | struct neighbour *neigh = dst->neighbour; | ||
754 | int header_len; | 761 | int header_len; |
755 | #ifdef CONFIG_NETFILTER | 762 | #ifdef CONFIG_NETFILTER |
756 | struct net_device *dev = skb->dev; | 763 | struct net_device *dev = skb->dev; |
@@ -783,7 +790,7 @@ static int dn_forward(struct sk_buff *skb) | |||
783 | cb->rt_flags |= DN_RT_F_IE; | 790 | cb->rt_flags |= DN_RT_F_IE; |
784 | 791 | ||
785 | return NF_HOOK(NFPROTO_DECNET, NF_DN_FORWARD, skb, dev, skb->dev, | 792 | return NF_HOOK(NFPROTO_DECNET, NF_DN_FORWARD, skb, dev, skb->dev, |
786 | neigh->output); | 793 | dn_to_neigh_output); |
787 | 794 | ||
788 | drop: | 795 | drop: |
789 | kfree_skb(skb); | 796 | kfree_skb(skb); |