aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/ip_gre.c
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2009-06-02 01:19:30 -0400
committerDavid S. Miller <davem@davemloft.net>2009-06-03 05:51:04 -0400
commitadf30907d63893e4208dfe3f5c88ae12bc2f25d5 (patch)
tree0f07542bb95de2ad537540868aba6cf87a86e17d /net/ipv4/ip_gre.c
parent511c3f92ad5b6d9f8f6464be1b4f85f0422be91a (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/ipv4/ip_gre.c')
-rw-r--r--net/ipv4/ip_gre.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 85ddad45a918..44e2a3d2359a 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -643,8 +643,7 @@ static int ipgre_rcv(struct sk_buff *skb)
643 stats->rx_packets++; 643 stats->rx_packets++;
644 stats->rx_bytes += len; 644 stats->rx_bytes += len;
645 skb->dev = tunnel->dev; 645 skb->dev = tunnel->dev;
646 dst_release(skb->dst); 646 skb_dst_drop(skb);
647 skb->dst = NULL;
648 nf_reset(skb); 647 nf_reset(skb);
649 648
650 skb_reset_network_header(skb); 649 skb_reset_network_header(skb);
@@ -698,7 +697,7 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
698 if ((dst = tiph->daddr) == 0) { 697 if ((dst = tiph->daddr) == 0) {
699 /* NBMA tunnel */ 698 /* NBMA tunnel */
700 699
701 if (skb->dst == NULL) { 700 if (skb_dst(skb) == NULL) {
702 stats->tx_fifo_errors++; 701 stats->tx_fifo_errors++;
703 goto tx_error; 702 goto tx_error;
704 } 703 }
@@ -712,7 +711,7 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
712 else if (skb->protocol == htons(ETH_P_IPV6)) { 711 else if (skb->protocol == htons(ETH_P_IPV6)) {
713 struct in6_addr *addr6; 712 struct in6_addr *addr6;
714 int addr_type; 713 int addr_type;
715 struct neighbour *neigh = skb->dst->neighbour; 714 struct neighbour *neigh = skb_dst(skb)->neighbour;
716 715
717 if (neigh == NULL) 716 if (neigh == NULL)
718 goto tx_error; 717 goto tx_error;
@@ -766,10 +765,10 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
766 if (df) 765 if (df)
767 mtu = dst_mtu(&rt->u.dst) - dev->hard_header_len - tunnel->hlen; 766 mtu = dst_mtu(&rt->u.dst) - dev->hard_header_len - tunnel->hlen;
768 else 767 else
769 mtu = skb->dst ? dst_mtu(skb->dst) : dev->mtu; 768 mtu = skb_dst(skb) ? dst_mtu(skb_dst(skb)) : dev->mtu;
770 769
771 if (skb->dst) 770 if (skb_dst(skb))
772 skb->dst->ops->update_pmtu(skb->dst, mtu); 771 skb_dst(skb)->ops->update_pmtu(skb_dst(skb), mtu);
773 772
774 if (skb->protocol == htons(ETH_P_IP)) { 773 if (skb->protocol == htons(ETH_P_IP)) {
775 df |= (old_iph->frag_off&htons(IP_DF)); 774 df |= (old_iph->frag_off&htons(IP_DF));
@@ -783,14 +782,14 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
783 } 782 }
784#ifdef CONFIG_IPV6 783#ifdef CONFIG_IPV6
785 else if (skb->protocol == htons(ETH_P_IPV6)) { 784 else if (skb->protocol == htons(ETH_P_IPV6)) {
786 struct rt6_info *rt6 = (struct rt6_info *)skb->dst; 785 struct rt6_info *rt6 = (struct rt6_info *)skb_dst(skb);
787 786
788 if (rt6 && mtu < dst_mtu(skb->dst) && mtu >= IPV6_MIN_MTU) { 787 if (rt6 && mtu < dst_mtu(skb_dst(skb)) && mtu >= IPV6_MIN_MTU) {
789 if ((tunnel->parms.iph.daddr && 788 if ((tunnel->parms.iph.daddr &&
790 !ipv4_is_multicast(tunnel->parms.iph.daddr)) || 789 !ipv4_is_multicast(tunnel->parms.iph.daddr)) ||
791 rt6->rt6i_dst.plen == 128) { 790 rt6->rt6i_dst.plen == 128) {
792 rt6->rt6i_flags |= RTF_MODIFIED; 791 rt6->rt6i_flags |= RTF_MODIFIED;
793 skb->dst->metrics[RTAX_MTU-1] = mtu; 792 skb_dst(skb)->metrics[RTAX_MTU-1] = mtu;
794 } 793 }
795 } 794 }
796 795
@@ -837,8 +836,8 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
837 memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); 836 memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
838 IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED | 837 IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED |
839 IPSKB_REROUTED); 838 IPSKB_REROUTED);
840 dst_release(skb->dst); 839 skb_dst_drop(skb);
841 skb->dst = &rt->u.dst; 840 skb_dst_set(skb, &rt->u.dst);
842 841
843 /* 842 /*
844 * Push down and install the IPIP header. 843 * Push down and install the IPIP header.