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/ipv4 | |
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/ipv4')
-rw-r--r-- | net/ipv4/arp.c | 2 | ||||
-rw-r--r-- | net/ipv4/icmp.c | 10 | ||||
-rw-r--r-- | net/ipv4/igmp.c | 4 | ||||
-rw-r--r-- | net/ipv4/ip_forward.c | 4 | ||||
-rw-r--r-- | net/ipv4/ip_fragment.c | 2 | ||||
-rw-r--r-- | net/ipv4/ip_gre.c | 23 | ||||
-rw-r--r-- | net/ipv4/ip_input.c | 6 | ||||
-rw-r--r-- | net/ipv4/ip_options.c | 6 | ||||
-rw-r--r-- | net/ipv4/ip_output.c | 20 | ||||
-rw-r--r-- | net/ipv4/ipip.c | 13 | ||||
-rw-r--r-- | net/ipv4/ipmr.c | 13 | ||||
-rw-r--r-- | net/ipv4/netfilter.c | 28 | ||||
-rw-r--r-- | net/ipv4/netfilter/ipt_REJECT.c | 7 | ||||
-rw-r--r-- | net/ipv4/netfilter/nf_nat_standalone.c | 7 | ||||
-rw-r--r-- | net/ipv4/raw.c | 2 | ||||
-rw-r--r-- | net/ipv4/route.c | 14 | ||||
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 4 | ||||
-rw-r--r-- | net/ipv4/tcp_output.c | 2 | ||||
-rw-r--r-- | net/ipv4/udp.c | 4 | ||||
-rw-r--r-- | net/ipv4/xfrm4_input.c | 2 | ||||
-rw-r--r-- | net/ipv4/xfrm4_mode_tunnel.c | 4 | ||||
-rw-r--r-- | net/ipv4/xfrm4_output.c | 6 |
22 files changed, 91 insertions, 92 deletions
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c index 816494f271a7..8a3881e28aca 100644 --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c | |||
@@ -468,7 +468,7 @@ int arp_find(unsigned char *haddr, struct sk_buff *skb) | |||
468 | __be32 paddr; | 468 | __be32 paddr; |
469 | struct neighbour *n; | 469 | struct neighbour *n; |
470 | 470 | ||
471 | if (!skb->dst) { | 471 | if (!skb_dst(skb)) { |
472 | printk(KERN_DEBUG "arp_find is called with dst==NULL\n"); | 472 | printk(KERN_DEBUG "arp_find is called with dst==NULL\n"); |
473 | kfree_skb(skb); | 473 | kfree_skb(skb); |
474 | return 1; | 474 | return 1; |
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index 94f75efae938..97c410e84388 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c | |||
@@ -591,13 +591,13 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info) | |||
591 | goto relookup_failed; | 591 | goto relookup_failed; |
592 | 592 | ||
593 | /* Ugh! */ | 593 | /* Ugh! */ |
594 | odst = skb_in->dst; | 594 | odst = skb_dst(skb_in); |
595 | err = ip_route_input(skb_in, fl.fl4_dst, fl.fl4_src, | 595 | err = ip_route_input(skb_in, fl.fl4_dst, fl.fl4_src, |
596 | RT_TOS(tos), rt2->u.dst.dev); | 596 | RT_TOS(tos), rt2->u.dst.dev); |
597 | 597 | ||
598 | dst_release(&rt2->u.dst); | 598 | dst_release(&rt2->u.dst); |
599 | rt2 = skb_rtable(skb_in); | 599 | rt2 = skb_rtable(skb_in); |
600 | skb_in->dst = odst; | 600 | skb_dst_set(skb_in, odst); |
601 | } | 601 | } |
602 | 602 | ||
603 | if (err) | 603 | if (err) |
@@ -659,7 +659,7 @@ static void icmp_unreach(struct sk_buff *skb) | |||
659 | u32 info = 0; | 659 | u32 info = 0; |
660 | struct net *net; | 660 | struct net *net; |
661 | 661 | ||
662 | net = dev_net(skb->dst->dev); | 662 | net = dev_net(skb_dst(skb)->dev); |
663 | 663 | ||
664 | /* | 664 | /* |
665 | * Incomplete header ? | 665 | * Incomplete header ? |
@@ -822,7 +822,7 @@ static void icmp_echo(struct sk_buff *skb) | |||
822 | { | 822 | { |
823 | struct net *net; | 823 | struct net *net; |
824 | 824 | ||
825 | net = dev_net(skb->dst->dev); | 825 | net = dev_net(skb_dst(skb)->dev); |
826 | if (!net->ipv4.sysctl_icmp_echo_ignore_all) { | 826 | if (!net->ipv4.sysctl_icmp_echo_ignore_all) { |
827 | struct icmp_bxm icmp_param; | 827 | struct icmp_bxm icmp_param; |
828 | 828 | ||
@@ -873,7 +873,7 @@ static void icmp_timestamp(struct sk_buff *skb) | |||
873 | out: | 873 | out: |
874 | return; | 874 | return; |
875 | out_err: | 875 | out_err: |
876 | ICMP_INC_STATS_BH(dev_net(skb->dst->dev), ICMP_MIB_INERRORS); | 876 | ICMP_INC_STATS_BH(dev_net(skb_dst(skb)->dev), ICMP_MIB_INERRORS); |
877 | goto out; | 877 | goto out; |
878 | } | 878 | } |
879 | 879 | ||
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index afabd2758b67..01b4284ed694 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c | |||
@@ -311,7 +311,7 @@ static struct sk_buff *igmpv3_newpack(struct net_device *dev, int size) | |||
311 | return NULL; | 311 | return NULL; |
312 | } | 312 | } |
313 | 313 | ||
314 | skb->dst = &rt->u.dst; | 314 | skb_dst_set(skb, &rt->u.dst); |
315 | skb->dev = dev; | 315 | skb->dev = dev; |
316 | 316 | ||
317 | skb_reserve(skb, LL_RESERVED_SPACE(dev)); | 317 | skb_reserve(skb, LL_RESERVED_SPACE(dev)); |
@@ -659,7 +659,7 @@ static int igmp_send_report(struct in_device *in_dev, struct ip_mc_list *pmc, | |||
659 | return -1; | 659 | return -1; |
660 | } | 660 | } |
661 | 661 | ||
662 | skb->dst = &rt->u.dst; | 662 | skb_dst_set(skb, &rt->u.dst); |
663 | 663 | ||
664 | skb_reserve(skb, LL_RESERVED_SPACE(dev)); | 664 | skb_reserve(skb, LL_RESERVED_SPACE(dev)); |
665 | 665 | ||
diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c index 0761cd9bbd10..a2991bc8e32e 100644 --- a/net/ipv4/ip_forward.c +++ b/net/ipv4/ip_forward.c | |||
@@ -42,7 +42,7 @@ static int ip_forward_finish(struct sk_buff *skb) | |||
42 | { | 42 | { |
43 | struct ip_options * opt = &(IPCB(skb)->opt); | 43 | struct ip_options * opt = &(IPCB(skb)->opt); |
44 | 44 | ||
45 | IP_INC_STATS_BH(dev_net(skb->dst->dev), IPSTATS_MIB_OUTFORWDATAGRAMS); | 45 | IP_INC_STATS_BH(dev_net(skb_dst(skb)->dev), IPSTATS_MIB_OUTFORWDATAGRAMS); |
46 | 46 | ||
47 | if (unlikely(opt->optlen)) | 47 | if (unlikely(opt->optlen)) |
48 | ip_forward_options(skb); | 48 | ip_forward_options(skb); |
@@ -123,7 +123,7 @@ sr_failed: | |||
123 | 123 | ||
124 | too_many_hops: | 124 | too_many_hops: |
125 | /* Tell the sender its packet died... */ | 125 | /* Tell the sender its packet died... */ |
126 | IP_INC_STATS_BH(dev_net(skb->dst->dev), IPSTATS_MIB_INHDRERRORS); | 126 | IP_INC_STATS_BH(dev_net(skb_dst(skb)->dev), IPSTATS_MIB_INHDRERRORS); |
127 | icmp_send(skb, ICMP_TIME_EXCEEDED, ICMP_EXC_TTL, 0); | 127 | icmp_send(skb, ICMP_TIME_EXCEEDED, ICMP_EXC_TTL, 0); |
128 | drop: | 128 | drop: |
129 | kfree_skb(skb); | 129 | kfree_skb(skb); |
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c index 7985346653bd..1f1b82475eaf 100644 --- a/net/ipv4/ip_fragment.c +++ b/net/ipv4/ip_fragment.c | |||
@@ -573,7 +573,7 @@ int ip_defrag(struct sk_buff *skb, u32 user) | |||
573 | struct ipq *qp; | 573 | struct ipq *qp; |
574 | struct net *net; | 574 | struct net *net; |
575 | 575 | ||
576 | net = skb->dev ? dev_net(skb->dev) : dev_net(skb->dst->dev); | 576 | net = skb->dev ? dev_net(skb->dev) : dev_net(skb_dst(skb)->dev); |
577 | IP_INC_STATS_BH(net, IPSTATS_MIB_REASMREQDS); | 577 | IP_INC_STATS_BH(net, IPSTATS_MIB_REASMREQDS); |
578 | 578 | ||
579 | /* Start by cleaning up the memory. */ | 579 | /* Start by cleaning up the memory. */ |
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. |
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c index cea784b0aa47..490ce20faf38 100644 --- a/net/ipv4/ip_input.c +++ b/net/ipv4/ip_input.c | |||
@@ -329,7 +329,7 @@ static int ip_rcv_finish(struct sk_buff *skb) | |||
329 | * Initialise the virtual path cache for the packet. It describes | 329 | * Initialise the virtual path cache for the packet. It describes |
330 | * how the packet travels inside Linux networking. | 330 | * how the packet travels inside Linux networking. |
331 | */ | 331 | */ |
332 | if (skb->dst == NULL) { | 332 | if (skb_dst(skb) == NULL) { |
333 | int err = ip_route_input(skb, iph->daddr, iph->saddr, iph->tos, | 333 | int err = ip_route_input(skb, iph->daddr, iph->saddr, iph->tos, |
334 | skb->dev); | 334 | skb->dev); |
335 | if (unlikely(err)) { | 335 | if (unlikely(err)) { |
@@ -344,9 +344,9 @@ static int ip_rcv_finish(struct sk_buff *skb) | |||
344 | } | 344 | } |
345 | 345 | ||
346 | #ifdef CONFIG_NET_CLS_ROUTE | 346 | #ifdef CONFIG_NET_CLS_ROUTE |
347 | if (unlikely(skb->dst->tclassid)) { | 347 | if (unlikely(skb_dst(skb)->tclassid)) { |
348 | struct ip_rt_acct *st = per_cpu_ptr(ip_rt_acct, smp_processor_id()); | 348 | struct ip_rt_acct *st = per_cpu_ptr(ip_rt_acct, smp_processor_id()); |
349 | u32 idx = skb->dst->tclassid; | 349 | u32 idx = skb_dst(skb)->tclassid; |
350 | st[idx&0xFF].o_packets++; | 350 | st[idx&0xFF].o_packets++; |
351 | st[idx&0xFF].o_bytes += skb->len; | 351 | st[idx&0xFF].o_bytes += skb->len; |
352 | st[(idx>>16)&0xFF].i_packets++; | 352 | st[(idx>>16)&0xFF].i_packets++; |
diff --git a/net/ipv4/ip_options.c b/net/ipv4/ip_options.c index 7e1074ffdbd1..94bf105ef3c9 100644 --- a/net/ipv4/ip_options.c +++ b/net/ipv4/ip_options.c | |||
@@ -143,7 +143,7 @@ int ip_options_echo(struct ip_options * dopt, struct sk_buff * skb) | |||
143 | __be32 addr; | 143 | __be32 addr; |
144 | 144 | ||
145 | memcpy(&addr, sptr+soffset-1, 4); | 145 | memcpy(&addr, sptr+soffset-1, 4); |
146 | if (inet_addr_type(dev_net(skb->dst->dev), addr) != RTN_LOCAL) { | 146 | if (inet_addr_type(dev_net(skb_dst(skb)->dev), addr) != RTN_LOCAL) { |
147 | dopt->ts_needtime = 1; | 147 | dopt->ts_needtime = 1; |
148 | soffset += 8; | 148 | soffset += 8; |
149 | } | 149 | } |
@@ -624,12 +624,12 @@ int ip_options_rcv_srr(struct sk_buff *skb) | |||
624 | memcpy(&nexthop, &optptr[srrptr-1], 4); | 624 | memcpy(&nexthop, &optptr[srrptr-1], 4); |
625 | 625 | ||
626 | rt = skb_rtable(skb); | 626 | rt = skb_rtable(skb); |
627 | skb->dst = NULL; | 627 | skb_dst_set(skb, NULL); |
628 | err = ip_route_input(skb, nexthop, iph->saddr, iph->tos, skb->dev); | 628 | err = ip_route_input(skb, nexthop, iph->saddr, iph->tos, skb->dev); |
629 | rt2 = skb_rtable(skb); | 629 | rt2 = skb_rtable(skb); |
630 | if (err || (rt2->rt_type != RTN_UNICAST && rt2->rt_type != RTN_LOCAL)) { | 630 | if (err || (rt2->rt_type != RTN_UNICAST && rt2->rt_type != RTN_LOCAL)) { |
631 | ip_rt_put(rt2); | 631 | ip_rt_put(rt2); |
632 | skb->dst = &rt->u.dst; | 632 | skb_dst_set(skb, &rt->u.dst); |
633 | return -EINVAL; | 633 | return -EINVAL; |
634 | } | 634 | } |
635 | ip_rt_put(rt); | 635 | ip_rt_put(rt); |
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index 8d845ebfccaa..3d6167fb2d97 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c | |||
@@ -95,7 +95,7 @@ int __ip_local_out(struct sk_buff *skb) | |||
95 | 95 | ||
96 | iph->tot_len = htons(skb->len); | 96 | iph->tot_len = htons(skb->len); |
97 | ip_send_check(iph); | 97 | ip_send_check(iph); |
98 | return nf_hook(PF_INET, NF_INET_LOCAL_OUT, skb, NULL, skb->dst->dev, | 98 | return nf_hook(PF_INET, NF_INET_LOCAL_OUT, skb, NULL, skb_dst(skb)->dev, |
99 | dst_output); | 99 | dst_output); |
100 | } | 100 | } |
101 | 101 | ||
@@ -118,7 +118,7 @@ static int ip_dev_loopback_xmit(struct sk_buff *newskb) | |||
118 | __skb_pull(newskb, skb_network_offset(newskb)); | 118 | __skb_pull(newskb, skb_network_offset(newskb)); |
119 | newskb->pkt_type = PACKET_LOOPBACK; | 119 | newskb->pkt_type = PACKET_LOOPBACK; |
120 | newskb->ip_summed = CHECKSUM_UNNECESSARY; | 120 | newskb->ip_summed = CHECKSUM_UNNECESSARY; |
121 | WARN_ON(!newskb->dst); | 121 | WARN_ON(!skb_dst(newskb)); |
122 | netif_rx(newskb); | 122 | netif_rx(newskb); |
123 | return 0; | 123 | return 0; |
124 | } | 124 | } |
@@ -176,7 +176,7 @@ EXPORT_SYMBOL_GPL(ip_build_and_send_pkt); | |||
176 | 176 | ||
177 | static inline int ip_finish_output2(struct sk_buff *skb) | 177 | static inline int ip_finish_output2(struct sk_buff *skb) |
178 | { | 178 | { |
179 | struct dst_entry *dst = skb->dst; | 179 | struct dst_entry *dst = skb_dst(skb); |
180 | struct rtable *rt = (struct rtable *)dst; | 180 | struct rtable *rt = (struct rtable *)dst; |
181 | struct net_device *dev = dst->dev; | 181 | struct net_device *dev = dst->dev; |
182 | unsigned int hh_len = LL_RESERVED_SPACE(dev); | 182 | unsigned int hh_len = LL_RESERVED_SPACE(dev); |
@@ -217,14 +217,14 @@ static inline int ip_skb_dst_mtu(struct sk_buff *skb) | |||
217 | struct inet_sock *inet = skb->sk ? inet_sk(skb->sk) : NULL; | 217 | struct inet_sock *inet = skb->sk ? inet_sk(skb->sk) : NULL; |
218 | 218 | ||
219 | return (inet && inet->pmtudisc == IP_PMTUDISC_PROBE) ? | 219 | return (inet && inet->pmtudisc == IP_PMTUDISC_PROBE) ? |
220 | skb->dst->dev->mtu : dst_mtu(skb->dst); | 220 | skb_dst(skb)->dev->mtu : dst_mtu(skb_dst(skb)); |
221 | } | 221 | } |
222 | 222 | ||
223 | static int ip_finish_output(struct sk_buff *skb) | 223 | static int ip_finish_output(struct sk_buff *skb) |
224 | { | 224 | { |
225 | #if defined(CONFIG_NETFILTER) && defined(CONFIG_XFRM) | 225 | #if defined(CONFIG_NETFILTER) && defined(CONFIG_XFRM) |
226 | /* Policy lookup after SNAT yielded a new policy */ | 226 | /* Policy lookup after SNAT yielded a new policy */ |
227 | if (skb->dst->xfrm != NULL) { | 227 | if (skb_dst(skb)->xfrm != NULL) { |
228 | IPCB(skb)->flags |= IPSKB_REROUTED; | 228 | IPCB(skb)->flags |= IPSKB_REROUTED; |
229 | return dst_output(skb); | 229 | return dst_output(skb); |
230 | } | 230 | } |
@@ -296,7 +296,7 @@ int ip_mc_output(struct sk_buff *skb) | |||
296 | 296 | ||
297 | int ip_output(struct sk_buff *skb) | 297 | int ip_output(struct sk_buff *skb) |
298 | { | 298 | { |
299 | struct net_device *dev = skb->dst->dev; | 299 | struct net_device *dev = skb_dst(skb)->dev; |
300 | 300 | ||
301 | IP_UPD_PO_STATS(dev_net(dev), IPSTATS_MIB_OUT, skb->len); | 301 | IP_UPD_PO_STATS(dev_net(dev), IPSTATS_MIB_OUT, skb->len); |
302 | 302 | ||
@@ -355,7 +355,7 @@ int ip_queue_xmit(struct sk_buff *skb, int ipfragok) | |||
355 | } | 355 | } |
356 | sk_setup_caps(sk, &rt->u.dst); | 356 | sk_setup_caps(sk, &rt->u.dst); |
357 | } | 357 | } |
358 | skb->dst = dst_clone(&rt->u.dst); | 358 | skb_dst_set(skb, dst_clone(&rt->u.dst)); |
359 | 359 | ||
360 | packet_routed: | 360 | packet_routed: |
361 | if (opt && opt->is_strictroute && rt->rt_dst != rt->rt_gateway) | 361 | if (opt && opt->is_strictroute && rt->rt_dst != rt->rt_gateway) |
@@ -401,8 +401,8 @@ static void ip_copy_metadata(struct sk_buff *to, struct sk_buff *from) | |||
401 | to->pkt_type = from->pkt_type; | 401 | to->pkt_type = from->pkt_type; |
402 | to->priority = from->priority; | 402 | to->priority = from->priority; |
403 | to->protocol = from->protocol; | 403 | to->protocol = from->protocol; |
404 | dst_release(to->dst); | 404 | skb_dst_drop(to); |
405 | to->dst = dst_clone(from->dst); | 405 | skb_dst_set(to, dst_clone(skb_dst(from))); |
406 | to->dev = from->dev; | 406 | to->dev = from->dev; |
407 | to->mark = from->mark; | 407 | to->mark = from->mark; |
408 | 408 | ||
@@ -1294,7 +1294,7 @@ int ip_push_pending_frames(struct sock *sk) | |||
1294 | * on dst refcount | 1294 | * on dst refcount |
1295 | */ | 1295 | */ |
1296 | inet->cork.dst = NULL; | 1296 | inet->cork.dst = NULL; |
1297 | skb->dst = &rt->u.dst; | 1297 | skb_dst_set(skb, &rt->u.dst); |
1298 | 1298 | ||
1299 | if (iph->protocol == IPPROTO_ICMP) | 1299 | if (iph->protocol == IPPROTO_ICMP) |
1300 | icmp_out_count(net, ((struct icmphdr *) | 1300 | icmp_out_count(net, ((struct icmphdr *) |
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c index 0c6e7bf18a43..93e2b787da20 100644 --- a/net/ipv4/ipip.c +++ b/net/ipv4/ipip.c | |||
@@ -370,8 +370,7 @@ static int ipip_rcv(struct sk_buff *skb) | |||
370 | tunnel->dev->stats.rx_packets++; | 370 | tunnel->dev->stats.rx_packets++; |
371 | tunnel->dev->stats.rx_bytes += skb->len; | 371 | tunnel->dev->stats.rx_bytes += skb->len; |
372 | skb->dev = tunnel->dev; | 372 | skb->dev = tunnel->dev; |
373 | dst_release(skb->dst); | 373 | skb_dst_drop(skb); |
374 | skb->dst = NULL; | ||
375 | nf_reset(skb); | 374 | nf_reset(skb); |
376 | ipip_ecn_decapsulate(iph, skb); | 375 | ipip_ecn_decapsulate(iph, skb); |
377 | netif_rx(skb); | 376 | netif_rx(skb); |
@@ -447,15 +446,15 @@ static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) | |||
447 | if (tiph->frag_off) | 446 | if (tiph->frag_off) |
448 | mtu = dst_mtu(&rt->u.dst) - sizeof(struct iphdr); | 447 | mtu = dst_mtu(&rt->u.dst) - sizeof(struct iphdr); |
449 | else | 448 | else |
450 | mtu = skb->dst ? dst_mtu(skb->dst) : dev->mtu; | 449 | mtu = skb_dst(skb) ? dst_mtu(skb_dst(skb)) : dev->mtu; |
451 | 450 | ||
452 | if (mtu < 68) { | 451 | if (mtu < 68) { |
453 | stats->collisions++; | 452 | stats->collisions++; |
454 | ip_rt_put(rt); | 453 | ip_rt_put(rt); |
455 | goto tx_error; | 454 | goto tx_error; |
456 | } | 455 | } |
457 | if (skb->dst) | 456 | if (skb_dst(skb)) |
458 | skb->dst->ops->update_pmtu(skb->dst, mtu); | 457 | skb_dst(skb)->ops->update_pmtu(skb_dst(skb), mtu); |
459 | 458 | ||
460 | df |= (old_iph->frag_off&htons(IP_DF)); | 459 | df |= (old_iph->frag_off&htons(IP_DF)); |
461 | 460 | ||
@@ -502,8 +501,8 @@ static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) | |||
502 | memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); | 501 | memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); |
503 | IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED | | 502 | IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED | |
504 | IPSKB_REROUTED); | 503 | IPSKB_REROUTED); |
505 | dst_release(skb->dst); | 504 | skb_dst_drop(skb); |
506 | skb->dst = &rt->u.dst; | 505 | skb_dst_set(skb, &rt->u.dst); |
507 | 506 | ||
508 | /* | 507 | /* |
509 | * Push down and install the IPIP header. | 508 | * Push down and install the IPIP header. |
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index 69dd058283eb..ffd986104468 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
@@ -651,7 +651,7 @@ static int ipmr_cache_report(struct net *net, | |||
651 | ip_hdr(skb)->protocol = 0; /* Flag to the kernel this is a route add */ | 651 | ip_hdr(skb)->protocol = 0; /* Flag to the kernel this is a route add */ |
652 | msg = (struct igmpmsg *)skb_network_header(skb); | 652 | msg = (struct igmpmsg *)skb_network_header(skb); |
653 | msg->im_vif = vifi; | 653 | msg->im_vif = vifi; |
654 | skb->dst = dst_clone(pkt->dst); | 654 | skb_dst_set(skb, dst_clone(skb_dst(pkt))); |
655 | 655 | ||
656 | /* | 656 | /* |
657 | * Add our header | 657 | * Add our header |
@@ -1201,7 +1201,7 @@ static void ip_encap(struct sk_buff *skb, __be32 saddr, __be32 daddr) | |||
1201 | iph->protocol = IPPROTO_IPIP; | 1201 | iph->protocol = IPPROTO_IPIP; |
1202 | iph->ihl = 5; | 1202 | iph->ihl = 5; |
1203 | iph->tot_len = htons(skb->len); | 1203 | iph->tot_len = htons(skb->len); |
1204 | ip_select_ident(iph, skb->dst, NULL); | 1204 | ip_select_ident(iph, skb_dst(skb), NULL); |
1205 | ip_send_check(iph); | 1205 | ip_send_check(iph); |
1206 | 1206 | ||
1207 | memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); | 1207 | memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); |
@@ -1212,7 +1212,7 @@ static inline int ipmr_forward_finish(struct sk_buff *skb) | |||
1212 | { | 1212 | { |
1213 | struct ip_options * opt = &(IPCB(skb)->opt); | 1213 | struct ip_options * opt = &(IPCB(skb)->opt); |
1214 | 1214 | ||
1215 | IP_INC_STATS_BH(dev_net(skb->dst->dev), IPSTATS_MIB_OUTFORWDATAGRAMS); | 1215 | IP_INC_STATS_BH(dev_net(skb_dst(skb)->dev), IPSTATS_MIB_OUTFORWDATAGRAMS); |
1216 | 1216 | ||
1217 | if (unlikely(opt->optlen)) | 1217 | if (unlikely(opt->optlen)) |
1218 | ip_forward_options(skb); | 1218 | ip_forward_options(skb); |
@@ -1290,8 +1290,8 @@ static void ipmr_queue_xmit(struct sk_buff *skb, struct mfc_cache *c, int vifi) | |||
1290 | vif->pkt_out++; | 1290 | vif->pkt_out++; |
1291 | vif->bytes_out += skb->len; | 1291 | vif->bytes_out += skb->len; |
1292 | 1292 | ||
1293 | dst_release(skb->dst); | 1293 | skb_dst_drop(skb); |
1294 | skb->dst = &rt->u.dst; | 1294 | skb_dst_set(skb, &rt->u.dst); |
1295 | ip_decrease_ttl(ip_hdr(skb)); | 1295 | ip_decrease_ttl(ip_hdr(skb)); |
1296 | 1296 | ||
1297 | /* FIXME: forward and output firewalls used to be called here. | 1297 | /* FIXME: forward and output firewalls used to be called here. |
@@ -1543,8 +1543,7 @@ static int __pim_rcv(struct sk_buff *skb, unsigned int pimlen) | |||
1543 | skb->protocol = htons(ETH_P_IP); | 1543 | skb->protocol = htons(ETH_P_IP); |
1544 | skb->ip_summed = 0; | 1544 | skb->ip_summed = 0; |
1545 | skb->pkt_type = PACKET_HOST; | 1545 | skb->pkt_type = PACKET_HOST; |
1546 | dst_release(skb->dst); | 1546 | skb_dst_drop(skb); |
1547 | skb->dst = NULL; | ||
1548 | reg_dev->stats.rx_bytes += skb->len; | 1547 | reg_dev->stats.rx_bytes += skb->len; |
1549 | reg_dev->stats.rx_packets++; | 1548 | reg_dev->stats.rx_packets++; |
1550 | nf_reset(skb); | 1549 | nf_reset(skb); |
diff --git a/net/ipv4/netfilter.c b/net/ipv4/netfilter.c index fdf6811c31a2..1725dc0ef688 100644 --- a/net/ipv4/netfilter.c +++ b/net/ipv4/netfilter.c | |||
@@ -12,7 +12,7 @@ | |||
12 | /* route_me_harder function, used by iptable_nat, iptable_mangle + ip_queue */ | 12 | /* route_me_harder function, used by iptable_nat, iptable_mangle + ip_queue */ |
13 | int ip_route_me_harder(struct sk_buff *skb, unsigned addr_type) | 13 | int ip_route_me_harder(struct sk_buff *skb, unsigned addr_type) |
14 | { | 14 | { |
15 | struct net *net = dev_net(skb->dst->dev); | 15 | struct net *net = dev_net(skb_dst(skb)->dev); |
16 | const struct iphdr *iph = ip_hdr(skb); | 16 | const struct iphdr *iph = ip_hdr(skb); |
17 | struct rtable *rt; | 17 | struct rtable *rt; |
18 | struct flowi fl = {}; | 18 | struct flowi fl = {}; |
@@ -41,8 +41,8 @@ int ip_route_me_harder(struct sk_buff *skb, unsigned addr_type) | |||
41 | return -1; | 41 | return -1; |
42 | 42 | ||
43 | /* Drop old route. */ | 43 | /* Drop old route. */ |
44 | dst_release(skb->dst); | 44 | skb_dst_drop(skb); |
45 | skb->dst = &rt->u.dst; | 45 | skb_dst_set(skb, &rt->u.dst); |
46 | } else { | 46 | } else { |
47 | /* non-local src, find valid iif to satisfy | 47 | /* non-local src, find valid iif to satisfy |
48 | * rp-filter when calling ip_route_input. */ | 48 | * rp-filter when calling ip_route_input. */ |
@@ -50,7 +50,7 @@ int ip_route_me_harder(struct sk_buff *skb, unsigned addr_type) | |||
50 | if (ip_route_output_key(net, &rt, &fl) != 0) | 50 | if (ip_route_output_key(net, &rt, &fl) != 0) |
51 | return -1; | 51 | return -1; |
52 | 52 | ||
53 | odst = skb->dst; | 53 | odst = skb_dst(skb); |
54 | if (ip_route_input(skb, iph->daddr, iph->saddr, | 54 | if (ip_route_input(skb, iph->daddr, iph->saddr, |
55 | RT_TOS(iph->tos), rt->u.dst.dev) != 0) { | 55 | RT_TOS(iph->tos), rt->u.dst.dev) != 0) { |
56 | dst_release(&rt->u.dst); | 56 | dst_release(&rt->u.dst); |
@@ -60,18 +60,22 @@ int ip_route_me_harder(struct sk_buff *skb, unsigned addr_type) | |||
60 | dst_release(odst); | 60 | dst_release(odst); |
61 | } | 61 | } |
62 | 62 | ||
63 | if (skb->dst->error) | 63 | if (skb_dst(skb)->error) |
64 | return -1; | 64 | return -1; |
65 | 65 | ||
66 | #ifdef CONFIG_XFRM | 66 | #ifdef CONFIG_XFRM |
67 | if (!(IPCB(skb)->flags & IPSKB_XFRM_TRANSFORMED) && | 67 | if (!(IPCB(skb)->flags & IPSKB_XFRM_TRANSFORMED) && |
68 | xfrm_decode_session(skb, &fl, AF_INET) == 0) | 68 | xfrm_decode_session(skb, &fl, AF_INET) == 0) { |
69 | if (xfrm_lookup(net, &skb->dst, &fl, skb->sk, 0)) | 69 | struct dst_entry *dst = skb_dst(skb); |
70 | skb_dst_set(skb, NULL); | ||
71 | if (xfrm_lookup(net, &dst, &fl, skb->sk, 0)) | ||
70 | return -1; | 72 | return -1; |
73 | skb_dst_set(skb, dst); | ||
74 | } | ||
71 | #endif | 75 | #endif |
72 | 76 | ||
73 | /* Change in oif may mean change in hh_len. */ | 77 | /* Change in oif may mean change in hh_len. */ |
74 | hh_len = skb->dst->dev->hard_header_len; | 78 | hh_len = skb_dst(skb)->dev->hard_header_len; |
75 | if (skb_headroom(skb) < hh_len && | 79 | if (skb_headroom(skb) < hh_len && |
76 | pskb_expand_head(skb, hh_len - skb_headroom(skb), 0, GFP_ATOMIC)) | 80 | pskb_expand_head(skb, hh_len - skb_headroom(skb), 0, GFP_ATOMIC)) |
77 | return -1; | 81 | return -1; |
@@ -92,7 +96,7 @@ int ip_xfrm_me_harder(struct sk_buff *skb) | |||
92 | if (xfrm_decode_session(skb, &fl, AF_INET) < 0) | 96 | if (xfrm_decode_session(skb, &fl, AF_INET) < 0) |
93 | return -1; | 97 | return -1; |
94 | 98 | ||
95 | dst = skb->dst; | 99 | dst = skb_dst(skb); |
96 | if (dst->xfrm) | 100 | if (dst->xfrm) |
97 | dst = ((struct xfrm_dst *)dst)->route; | 101 | dst = ((struct xfrm_dst *)dst)->route; |
98 | dst_hold(dst); | 102 | dst_hold(dst); |
@@ -100,11 +104,11 @@ int ip_xfrm_me_harder(struct sk_buff *skb) | |||
100 | if (xfrm_lookup(dev_net(dst->dev), &dst, &fl, skb->sk, 0) < 0) | 104 | if (xfrm_lookup(dev_net(dst->dev), &dst, &fl, skb->sk, 0) < 0) |
101 | return -1; | 105 | return -1; |
102 | 106 | ||
103 | dst_release(skb->dst); | 107 | skb_dst_drop(skb); |
104 | skb->dst = dst; | 108 | skb_dst_set(skb, dst); |
105 | 109 | ||
106 | /* Change in oif may mean change in hh_len. */ | 110 | /* Change in oif may mean change in hh_len. */ |
107 | hh_len = skb->dst->dev->hard_header_len; | 111 | hh_len = skb_dst(skb)->dev->hard_header_len; |
108 | if (skb_headroom(skb) < hh_len && | 112 | if (skb_headroom(skb) < hh_len && |
109 | pskb_expand_head(skb, hh_len - skb_headroom(skb), 0, GFP_ATOMIC)) | 113 | pskb_expand_head(skb, hh_len - skb_headroom(skb), 0, GFP_ATOMIC)) |
110 | return -1; | 114 | return -1; |
diff --git a/net/ipv4/netfilter/ipt_REJECT.c b/net/ipv4/netfilter/ipt_REJECT.c index 0b4b6e0ff2b9..c93ae44bff2a 100644 --- a/net/ipv4/netfilter/ipt_REJECT.c +++ b/net/ipv4/netfilter/ipt_REJECT.c | |||
@@ -108,17 +108,16 @@ static void send_reset(struct sk_buff *oldskb, int hook) | |||
108 | addr_type = RTN_LOCAL; | 108 | addr_type = RTN_LOCAL; |
109 | 109 | ||
110 | /* ip_route_me_harder expects skb->dst to be set */ | 110 | /* ip_route_me_harder expects skb->dst to be set */ |
111 | dst_hold(oldskb->dst); | 111 | skb_dst_set(nskb, dst_clone(skb_dst(oldskb))); |
112 | nskb->dst = oldskb->dst; | ||
113 | 112 | ||
114 | if (ip_route_me_harder(nskb, addr_type)) | 113 | if (ip_route_me_harder(nskb, addr_type)) |
115 | goto free_nskb; | 114 | goto free_nskb; |
116 | 115 | ||
117 | niph->ttl = dst_metric(nskb->dst, RTAX_HOPLIMIT); | 116 | niph->ttl = dst_metric(skb_dst(nskb), RTAX_HOPLIMIT); |
118 | nskb->ip_summed = CHECKSUM_NONE; | 117 | nskb->ip_summed = CHECKSUM_NONE; |
119 | 118 | ||
120 | /* "Never happens" */ | 119 | /* "Never happens" */ |
121 | if (nskb->len > dst_mtu(nskb->dst)) | 120 | if (nskb->len > dst_mtu(skb_dst(nskb))) |
122 | goto free_nskb; | 121 | goto free_nskb; |
123 | 122 | ||
124 | nf_ct_attach(nskb, oldskb); | 123 | nf_ct_attach(nskb, oldskb); |
diff --git a/net/ipv4/netfilter/nf_nat_standalone.c b/net/ipv4/netfilter/nf_nat_standalone.c index b7dd695691a0..5567bd0d0750 100644 --- a/net/ipv4/netfilter/nf_nat_standalone.c +++ b/net/ipv4/netfilter/nf_nat_standalone.c | |||
@@ -167,10 +167,9 @@ nf_nat_in(unsigned int hooknum, | |||
167 | 167 | ||
168 | ret = nf_nat_fn(hooknum, skb, in, out, okfn); | 168 | ret = nf_nat_fn(hooknum, skb, in, out, okfn); |
169 | if (ret != NF_DROP && ret != NF_STOLEN && | 169 | if (ret != NF_DROP && ret != NF_STOLEN && |
170 | daddr != ip_hdr(skb)->daddr) { | 170 | daddr != ip_hdr(skb)->daddr) |
171 | dst_release(skb->dst); | 171 | skb_dst_drop(skb); |
172 | skb->dst = NULL; | 172 | |
173 | } | ||
174 | return ret; | 173 | return ret; |
175 | } | 174 | } |
176 | 175 | ||
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index f774651f0a47..3dc9171a272f 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c | |||
@@ -343,7 +343,7 @@ static int raw_send_hdrinc(struct sock *sk, void *from, size_t length, | |||
343 | 343 | ||
344 | skb->priority = sk->sk_priority; | 344 | skb->priority = sk->sk_priority; |
345 | skb->mark = sk->sk_mark; | 345 | skb->mark = sk->sk_mark; |
346 | skb->dst = dst_clone(&rt->u.dst); | 346 | skb_dst_set(skb, dst_clone(&rt->u.dst)); |
347 | 347 | ||
348 | skb_reset_network_header(skb); | 348 | skb_reset_network_header(skb); |
349 | iph = ip_hdr(skb); | 349 | iph = ip_hdr(skb); |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index f20060ac2f09..a849bb15d864 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -1118,7 +1118,7 @@ restart: | |||
1118 | if (rp) | 1118 | if (rp) |
1119 | *rp = rth; | 1119 | *rp = rth; |
1120 | else | 1120 | else |
1121 | skb->dst = &rth->u.dst; | 1121 | skb_dst_set(skb, &rth->u.dst); |
1122 | return 0; | 1122 | return 0; |
1123 | } | 1123 | } |
1124 | 1124 | ||
@@ -1217,7 +1217,7 @@ restart: | |||
1217 | if (rp) | 1217 | if (rp) |
1218 | *rp = rt; | 1218 | *rp = rt; |
1219 | else | 1219 | else |
1220 | skb->dst = &rt->u.dst; | 1220 | skb_dst_set(skb, &rt->u.dst); |
1221 | return 0; | 1221 | return 0; |
1222 | } | 1222 | } |
1223 | 1223 | ||
@@ -2251,7 +2251,7 @@ int ip_route_input(struct sk_buff *skb, __be32 daddr, __be32 saddr, | |||
2251 | dst_use(&rth->u.dst, jiffies); | 2251 | dst_use(&rth->u.dst, jiffies); |
2252 | RT_CACHE_STAT_INC(in_hit); | 2252 | RT_CACHE_STAT_INC(in_hit); |
2253 | rcu_read_unlock(); | 2253 | rcu_read_unlock(); |
2254 | skb->dst = &rth->u.dst; | 2254 | skb_dst_set(skb, &rth->u.dst); |
2255 | return 0; | 2255 | return 0; |
2256 | } | 2256 | } |
2257 | RT_CACHE_STAT_INC(in_hlist_search); | 2257 | RT_CACHE_STAT_INC(in_hlist_search); |
@@ -2934,7 +2934,7 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void | |||
2934 | if (err) | 2934 | if (err) |
2935 | goto errout_free; | 2935 | goto errout_free; |
2936 | 2936 | ||
2937 | skb->dst = &rt->u.dst; | 2937 | skb_dst_set(skb, &rt->u.dst); |
2938 | if (rtm->rtm_flags & RTM_F_NOTIFY) | 2938 | if (rtm->rtm_flags & RTM_F_NOTIFY) |
2939 | rt->rt_flags |= RTCF_NOTIFY; | 2939 | rt->rt_flags |= RTCF_NOTIFY; |
2940 | 2940 | ||
@@ -2975,15 +2975,15 @@ int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb) | |||
2975 | continue; | 2975 | continue; |
2976 | if (rt_is_expired(rt)) | 2976 | if (rt_is_expired(rt)) |
2977 | continue; | 2977 | continue; |
2978 | skb->dst = dst_clone(&rt->u.dst); | 2978 | skb_dst_set(skb, dst_clone(&rt->u.dst)); |
2979 | if (rt_fill_info(net, skb, NETLINK_CB(cb->skb).pid, | 2979 | if (rt_fill_info(net, skb, NETLINK_CB(cb->skb).pid, |
2980 | cb->nlh->nlmsg_seq, RTM_NEWROUTE, | 2980 | cb->nlh->nlmsg_seq, RTM_NEWROUTE, |
2981 | 1, NLM_F_MULTI) <= 0) { | 2981 | 1, NLM_F_MULTI) <= 0) { |
2982 | dst_release(xchg(&skb->dst, NULL)); | 2982 | skb_dst_drop(skb); |
2983 | rcu_read_unlock_bh(); | 2983 | rcu_read_unlock_bh(); |
2984 | goto done; | 2984 | goto done; |
2985 | } | 2985 | } |
2986 | dst_release(xchg(&skb->dst, NULL)); | 2986 | skb_dst_drop(skb); |
2987 | } | 2987 | } |
2988 | rcu_read_unlock_bh(); | 2988 | rcu_read_unlock_bh(); |
2989 | } | 2989 | } |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 319c88526449..5a1ca2698c88 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -590,7 +590,7 @@ static void tcp_v4_send_reset(struct sock *sk, struct sk_buff *skb) | |||
590 | arg.csumoffset = offsetof(struct tcphdr, check) / 2; | 590 | arg.csumoffset = offsetof(struct tcphdr, check) / 2; |
591 | arg.flags = (sk && inet_sk(sk)->transparent) ? IP_REPLY_ARG_NOSRCCHECK : 0; | 591 | arg.flags = (sk && inet_sk(sk)->transparent) ? IP_REPLY_ARG_NOSRCCHECK : 0; |
592 | 592 | ||
593 | net = dev_net(skb->dst->dev); | 593 | net = dev_net(skb_dst(skb)->dev); |
594 | ip_send_reply(net->ipv4.tcp_sock, skb, | 594 | ip_send_reply(net->ipv4.tcp_sock, skb, |
595 | &arg, arg.iov[0].iov_len); | 595 | &arg, arg.iov[0].iov_len); |
596 | 596 | ||
@@ -617,7 +617,7 @@ static void tcp_v4_send_ack(struct sk_buff *skb, u32 seq, u32 ack, | |||
617 | ]; | 617 | ]; |
618 | } rep; | 618 | } rep; |
619 | struct ip_reply_arg arg; | 619 | struct ip_reply_arg arg; |
620 | struct net *net = dev_net(skb->dst->dev); | 620 | struct net *net = dev_net(skb_dst(skb)->dev); |
621 | 621 | ||
622 | memset(&rep.th, 0, sizeof(struct tcphdr)); | 622 | memset(&rep.th, 0, sizeof(struct tcphdr)); |
623 | memset(&arg, 0, sizeof(arg)); | 623 | memset(&arg, 0, sizeof(arg)); |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 79c39dc9b01c..416fc4c2e7eb 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -2202,7 +2202,7 @@ struct sk_buff *tcp_make_synack(struct sock *sk, struct dst_entry *dst, | |||
2202 | /* Reserve space for headers. */ | 2202 | /* Reserve space for headers. */ |
2203 | skb_reserve(skb, MAX_TCP_HEADER); | 2203 | skb_reserve(skb, MAX_TCP_HEADER); |
2204 | 2204 | ||
2205 | skb->dst = dst_clone(dst); | 2205 | skb_dst_set(skb, dst_clone(dst)); |
2206 | 2206 | ||
2207 | mss = dst_metric(dst, RTAX_ADVMSS); | 2207 | mss = dst_metric(dst, RTAX_ADVMSS); |
2208 | if (tp->rx_opt.user_mss && tp->rx_opt.user_mss < mss) | 2208 | if (tp->rx_opt.user_mss && tp->rx_opt.user_mss < mss) |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 7a1d1ce22e66..8f4158d7c9a6 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -328,7 +328,7 @@ static inline struct sock *__udp4_lib_lookup_skb(struct sk_buff *skb, | |||
328 | if (unlikely(sk = skb_steal_sock(skb))) | 328 | if (unlikely(sk = skb_steal_sock(skb))) |
329 | return sk; | 329 | return sk; |
330 | else | 330 | else |
331 | return __udp4_lib_lookup(dev_net(skb->dst->dev), iph->saddr, sport, | 331 | return __udp4_lib_lookup(dev_net(skb_dst(skb)->dev), iph->saddr, sport, |
332 | iph->daddr, dport, inet_iif(skb), | 332 | iph->daddr, dport, inet_iif(skb), |
333 | udptable); | 333 | udptable); |
334 | } | 334 | } |
@@ -1237,7 +1237,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable, | |||
1237 | struct sock *sk; | 1237 | struct sock *sk; |
1238 | struct udphdr *uh; | 1238 | struct udphdr *uh; |
1239 | unsigned short ulen; | 1239 | unsigned short ulen; |
1240 | struct rtable *rt = (struct rtable*)skb->dst; | 1240 | struct rtable *rt = skb_rtable(skb); |
1241 | __be32 saddr, daddr; | 1241 | __be32 saddr, daddr; |
1242 | struct net *net = dev_net(skb->dev); | 1242 | struct net *net = dev_net(skb->dev); |
1243 | 1243 | ||
diff --git a/net/ipv4/xfrm4_input.c b/net/ipv4/xfrm4_input.c index 4ec2162a437e..f9f922a0ba88 100644 --- a/net/ipv4/xfrm4_input.c +++ b/net/ipv4/xfrm4_input.c | |||
@@ -23,7 +23,7 @@ int xfrm4_extract_input(struct xfrm_state *x, struct sk_buff *skb) | |||
23 | 23 | ||
24 | static inline int xfrm4_rcv_encap_finish(struct sk_buff *skb) | 24 | static inline int xfrm4_rcv_encap_finish(struct sk_buff *skb) |
25 | { | 25 | { |
26 | if (skb->dst == NULL) { | 26 | if (skb_dst(skb) == NULL) { |
27 | const struct iphdr *iph = ip_hdr(skb); | 27 | const struct iphdr *iph = ip_hdr(skb); |
28 | 28 | ||
29 | if (ip_route_input(skb, iph->daddr, iph->saddr, iph->tos, | 29 | if (ip_route_input(skb, iph->daddr, iph->saddr, iph->tos, |
diff --git a/net/ipv4/xfrm4_mode_tunnel.c b/net/ipv4/xfrm4_mode_tunnel.c index 7135279f3f84..3444f3b34eca 100644 --- a/net/ipv4/xfrm4_mode_tunnel.c +++ b/net/ipv4/xfrm4_mode_tunnel.c | |||
@@ -28,7 +28,7 @@ static inline void ipip_ecn_decapsulate(struct sk_buff *skb) | |||
28 | */ | 28 | */ |
29 | static int xfrm4_mode_tunnel_output(struct xfrm_state *x, struct sk_buff *skb) | 29 | static int xfrm4_mode_tunnel_output(struct xfrm_state *x, struct sk_buff *skb) |
30 | { | 30 | { |
31 | struct dst_entry *dst = skb->dst; | 31 | struct dst_entry *dst = skb_dst(skb); |
32 | struct iphdr *top_iph; | 32 | struct iphdr *top_iph; |
33 | int flags; | 33 | int flags; |
34 | 34 | ||
@@ -41,7 +41,7 @@ static int xfrm4_mode_tunnel_output(struct xfrm_state *x, struct sk_buff *skb) | |||
41 | top_iph->ihl = 5; | 41 | top_iph->ihl = 5; |
42 | top_iph->version = 4; | 42 | top_iph->version = 4; |
43 | 43 | ||
44 | top_iph->protocol = xfrm_af2proto(skb->dst->ops->family); | 44 | top_iph->protocol = xfrm_af2proto(skb_dst(skb)->ops->family); |
45 | 45 | ||
46 | /* DS disclosed */ | 46 | /* DS disclosed */ |
47 | top_iph->tos = INET_ECN_encapsulate(XFRM_MODE_SKB_CB(skb)->tos, | 47 | top_iph->tos = INET_ECN_encapsulate(XFRM_MODE_SKB_CB(skb)->tos, |
diff --git a/net/ipv4/xfrm4_output.c b/net/ipv4/xfrm4_output.c index 8c3180adddbf..c908bd99bcba 100644 --- a/net/ipv4/xfrm4_output.c +++ b/net/ipv4/xfrm4_output.c | |||
@@ -29,7 +29,7 @@ static int xfrm4_tunnel_check_size(struct sk_buff *skb) | |||
29 | if (!(ip_hdr(skb)->frag_off & htons(IP_DF)) || skb->local_df) | 29 | if (!(ip_hdr(skb)->frag_off & htons(IP_DF)) || skb->local_df) |
30 | goto out; | 30 | goto out; |
31 | 31 | ||
32 | dst = skb->dst; | 32 | dst = skb_dst(skb); |
33 | mtu = dst_mtu(dst); | 33 | mtu = dst_mtu(dst); |
34 | if (skb->len > mtu) { | 34 | if (skb->len > mtu) { |
35 | icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, htonl(mtu)); | 35 | icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, htonl(mtu)); |
@@ -72,7 +72,7 @@ EXPORT_SYMBOL(xfrm4_prepare_output); | |||
72 | static int xfrm4_output_finish(struct sk_buff *skb) | 72 | static int xfrm4_output_finish(struct sk_buff *skb) |
73 | { | 73 | { |
74 | #ifdef CONFIG_NETFILTER | 74 | #ifdef CONFIG_NETFILTER |
75 | if (!skb->dst->xfrm) { | 75 | if (!skb_dst(skb)->xfrm) { |
76 | IPCB(skb)->flags |= IPSKB_REROUTED; | 76 | IPCB(skb)->flags |= IPSKB_REROUTED; |
77 | return dst_output(skb); | 77 | return dst_output(skb); |
78 | } | 78 | } |
@@ -87,6 +87,6 @@ static int xfrm4_output_finish(struct sk_buff *skb) | |||
87 | int xfrm4_output(struct sk_buff *skb) | 87 | int xfrm4_output(struct sk_buff *skb) |
88 | { | 88 | { |
89 | return NF_HOOK_COND(PF_INET, NF_INET_POST_ROUTING, skb, | 89 | return NF_HOOK_COND(PF_INET, NF_INET_POST_ROUTING, skb, |
90 | NULL, skb->dst->dev, xfrm4_output_finish, | 90 | NULL, skb_dst(skb)->dev, xfrm4_output_finish, |
91 | !(IPCB(skb)->flags & IPSKB_REROUTED)); | 91 | !(IPCB(skb)->flags & IPSKB_REROUTED)); |
92 | } | 92 | } |