diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2009-06-02 01:19:30 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-06-03 05:51:04 -0400 |
commit | adf30907d63893e4208dfe3f5c88ae12bc2f25d5 (patch) | |
tree | 0f07542bb95de2ad537540868aba6cf87a86e17d /net/bridge | |
parent | 511c3f92ad5b6d9f8f6464be1b4f85f0422be91a (diff) |
net: skb->dst accessors
Define three accessors to get/set dst attached to a skb
struct dst_entry *skb_dst(const struct sk_buff *skb)
void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst)
void skb_dst_drop(struct sk_buff *skb)
This one should replace occurrences of :
dst_release(skb->dst)
skb->dst = NULL;
Delete skb->dst field
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge')
-rw-r--r-- | net/bridge/br_netfilter.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c index e0ceb66a9ec5..d22f611e4004 100644 --- a/net/bridge/br_netfilter.c +++ b/net/bridge/br_netfilter.c | |||
@@ -242,7 +242,7 @@ static int br_nf_pre_routing_finish_ipv6(struct sk_buff *skb) | |||
242 | return 0; | 242 | return 0; |
243 | } | 243 | } |
244 | dst_hold(&rt->u.dst); | 244 | dst_hold(&rt->u.dst); |
245 | skb->dst = &rt->u.dst; | 245 | skb_dst_set(skb, &rt->u.dst); |
246 | 246 | ||
247 | skb->dev = nf_bridge->physindev; | 247 | skb->dev = nf_bridge->physindev; |
248 | nf_bridge_push_encap_header(skb); | 248 | nf_bridge_push_encap_header(skb); |
@@ -322,7 +322,7 @@ static int br_nf_pre_routing_finish_bridge(struct sk_buff *skb) | |||
322 | 322 | ||
323 | skb->dev = bridge_parent(skb->dev); | 323 | skb->dev = bridge_parent(skb->dev); |
324 | if (skb->dev) { | 324 | if (skb->dev) { |
325 | struct dst_entry *dst = skb->dst; | 325 | struct dst_entry *dst = skb_dst(skb); |
326 | 326 | ||
327 | nf_bridge_pull_encap_header(skb); | 327 | nf_bridge_pull_encap_header(skb); |
328 | 328 | ||
@@ -375,7 +375,7 @@ static int br_nf_pre_routing_finish(struct sk_buff *skb) | |||
375 | /* - Bridged-and-DNAT'ed traffic doesn't | 375 | /* - Bridged-and-DNAT'ed traffic doesn't |
376 | * require ip_forwarding. */ | 376 | * require ip_forwarding. */ |
377 | if (((struct dst_entry *)rt)->dev == dev) { | 377 | if (((struct dst_entry *)rt)->dev == dev) { |
378 | skb->dst = (struct dst_entry *)rt; | 378 | skb_dst_set(skb, (struct dst_entry *)rt); |
379 | goto bridged_dnat; | 379 | goto bridged_dnat; |
380 | } | 380 | } |
381 | /* we are sure that forwarding is disabled, so printing | 381 | /* we are sure that forwarding is disabled, so printing |
@@ -389,7 +389,7 @@ free_skb: | |||
389 | kfree_skb(skb); | 389 | kfree_skb(skb); |
390 | return 0; | 390 | return 0; |
391 | } else { | 391 | } else { |
392 | if (skb->dst->dev == dev) { | 392 | if (skb_dst(skb)->dev == dev) { |
393 | bridged_dnat: | 393 | bridged_dnat: |
394 | /* Tell br_nf_local_out this is a | 394 | /* Tell br_nf_local_out this is a |
395 | * bridged frame */ | 395 | * bridged frame */ |
@@ -412,7 +412,7 @@ bridged_dnat: | |||
412 | return 0; | 412 | return 0; |
413 | } | 413 | } |
414 | dst_hold(&rt->u.dst); | 414 | dst_hold(&rt->u.dst); |
415 | skb->dst = &rt->u.dst; | 415 | skb_dst_set(skb, &rt->u.dst); |
416 | } | 416 | } |
417 | 417 | ||
418 | skb->dev = nf_bridge->physindev; | 418 | skb->dev = nf_bridge->physindev; |
@@ -633,10 +633,8 @@ static unsigned int br_nf_local_in(unsigned int hook, struct sk_buff *skb, | |||
633 | { | 633 | { |
634 | struct rtable *rt = skb_rtable(skb); | 634 | struct rtable *rt = skb_rtable(skb); |
635 | 635 | ||
636 | if (rt && rt == bridge_parent_rtable(in)) { | 636 | if (rt && rt == bridge_parent_rtable(in)) |
637 | dst_release(&rt->u.dst); | 637 | skb_dst_drop(skb); |
638 | skb->dst = NULL; | ||
639 | } | ||
640 | 638 | ||
641 | return NF_ACCEPT; | 639 | return NF_ACCEPT; |
642 | } | 640 | } |
@@ -851,7 +849,7 @@ static unsigned int br_nf_post_routing(unsigned int hook, struct sk_buff *skb, | |||
851 | return NF_ACCEPT; | 849 | return NF_ACCEPT; |
852 | 850 | ||
853 | #ifdef CONFIG_NETFILTER_DEBUG | 851 | #ifdef CONFIG_NETFILTER_DEBUG |
854 | if (skb->dst == NULL) { | 852 | if (skb_dst(skb) == NULL) { |
855 | printk(KERN_INFO "br_netfilter post_routing: skb->dst == NULL\n"); | 853 | printk(KERN_INFO "br_netfilter post_routing: skb->dst == NULL\n"); |
856 | goto print_error; | 854 | goto print_error; |
857 | } | 855 | } |