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/ipv6/ip6_tunnel.c | |
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/ipv6/ip6_tunnel.c')
-rw-r--r-- | net/ipv6/ip6_tunnel.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index af256d47fd35..404d16a97d5c 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c | |||
@@ -532,8 +532,8 @@ ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
532 | if (!skb2) | 532 | if (!skb2) |
533 | return 0; | 533 | return 0; |
534 | 534 | ||
535 | dst_release(skb2->dst); | 535 | skb_dst_drop(skb2); |
536 | skb2->dst = NULL; | 536 | |
537 | skb_pull(skb2, offset); | 537 | skb_pull(skb2, offset); |
538 | skb_reset_network_header(skb2); | 538 | skb_reset_network_header(skb2); |
539 | eiph = ip_hdr(skb2); | 539 | eiph = ip_hdr(skb2); |
@@ -560,21 +560,21 @@ ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
560 | ip_rt_put(rt); | 560 | ip_rt_put(rt); |
561 | goto out; | 561 | goto out; |
562 | } | 562 | } |
563 | skb2->dst = (struct dst_entry *)rt; | 563 | skb_dst_set(skb2, (struct dst_entry *)rt); |
564 | } else { | 564 | } else { |
565 | ip_rt_put(rt); | 565 | ip_rt_put(rt); |
566 | if (ip_route_input(skb2, eiph->daddr, eiph->saddr, eiph->tos, | 566 | if (ip_route_input(skb2, eiph->daddr, eiph->saddr, eiph->tos, |
567 | skb2->dev) || | 567 | skb2->dev) || |
568 | skb2->dst->dev->type != ARPHRD_TUNNEL) | 568 | skb_dst(skb2)->dev->type != ARPHRD_TUNNEL) |
569 | goto out; | 569 | goto out; |
570 | } | 570 | } |
571 | 571 | ||
572 | /* change mtu on this route */ | 572 | /* change mtu on this route */ |
573 | if (rel_type == ICMP_DEST_UNREACH && rel_code == ICMP_FRAG_NEEDED) { | 573 | if (rel_type == ICMP_DEST_UNREACH && rel_code == ICMP_FRAG_NEEDED) { |
574 | if (rel_info > dst_mtu(skb2->dst)) | 574 | if (rel_info > dst_mtu(skb_dst(skb2))) |
575 | goto out; | 575 | goto out; |
576 | 576 | ||
577 | skb2->dst->ops->update_pmtu(skb2->dst, rel_info); | 577 | skb_dst(skb2)->ops->update_pmtu(skb_dst(skb2), rel_info); |
578 | } | 578 | } |
579 | 579 | ||
580 | icmp_send(skb2, rel_type, rel_code, htonl(rel_info)); | 580 | icmp_send(skb2, rel_type, rel_code, htonl(rel_info)); |
@@ -606,8 +606,7 @@ ip6ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
606 | if (!skb2) | 606 | if (!skb2) |
607 | return 0; | 607 | return 0; |
608 | 608 | ||
609 | dst_release(skb2->dst); | 609 | skb_dst_drop(skb2); |
610 | skb2->dst = NULL; | ||
611 | skb_pull(skb2, offset); | 610 | skb_pull(skb2, offset); |
612 | skb_reset_network_header(skb2); | 611 | skb_reset_network_header(skb2); |
613 | 612 | ||
@@ -720,8 +719,7 @@ static int ip6_tnl_rcv(struct sk_buff *skb, __u16 protocol, | |||
720 | skb->pkt_type = PACKET_HOST; | 719 | skb->pkt_type = PACKET_HOST; |
721 | memset(skb->cb, 0, sizeof(struct inet6_skb_parm)); | 720 | memset(skb->cb, 0, sizeof(struct inet6_skb_parm)); |
722 | skb->dev = t->dev; | 721 | skb->dev = t->dev; |
723 | dst_release(skb->dst); | 722 | skb_dst_drop(skb); |
724 | skb->dst = NULL; | ||
725 | nf_reset(skb); | 723 | nf_reset(skb); |
726 | 724 | ||
727 | dscp_ecn_decapsulate(t, ipv6h, skb); | 725 | dscp_ecn_decapsulate(t, ipv6h, skb); |
@@ -885,8 +883,8 @@ static int ip6_tnl_xmit2(struct sk_buff *skb, | |||
885 | } | 883 | } |
886 | if (mtu < IPV6_MIN_MTU) | 884 | if (mtu < IPV6_MIN_MTU) |
887 | mtu = IPV6_MIN_MTU; | 885 | mtu = IPV6_MIN_MTU; |
888 | if (skb->dst) | 886 | if (skb_dst(skb)) |
889 | skb->dst->ops->update_pmtu(skb->dst, mtu); | 887 | skb_dst(skb)->ops->update_pmtu(skb_dst(skb), mtu); |
890 | if (skb->len > mtu) { | 888 | if (skb->len > mtu) { |
891 | *pmtu = mtu; | 889 | *pmtu = mtu; |
892 | err = -EMSGSIZE; | 890 | err = -EMSGSIZE; |
@@ -910,8 +908,8 @@ static int ip6_tnl_xmit2(struct sk_buff *skb, | |||
910 | kfree_skb(skb); | 908 | kfree_skb(skb); |
911 | skb = new_skb; | 909 | skb = new_skb; |
912 | } | 910 | } |
913 | dst_release(skb->dst); | 911 | skb_dst_drop(skb); |
914 | skb->dst = dst_clone(dst); | 912 | skb_dst_set(skb, dst_clone(dst)); |
915 | 913 | ||
916 | skb->transport_header = skb->network_header; | 914 | skb->transport_header = skb->network_header; |
917 | 915 | ||