aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6
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/ipv6
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/ipv6')
-rw-r--r--net/ipv6/exthdrs.c40
-rw-r--r--net/ipv6/inet6_connection_sock.c2
-rw-r--r--net/ipv6/ip6_input.c12
-rw-r--r--net/ipv6/ip6_output.c60
-rw-r--r--net/ipv6/ip6_tunnel.c26
-rw-r--r--net/ipv6/ip6mr.c13
-rw-r--r--net/ipv6/mcast.c17
-rw-r--r--net/ipv6/ndisc.c4
-rw-r--r--net/ipv6/netfilter.c16
-rw-r--r--net/ipv6/netfilter/ip6t_REJECT.c2
-rw-r--r--net/ipv6/raw.c2
-rw-r--r--net/ipv6/reassembly.c22
-rw-r--r--net/ipv6/route.c12
-rw-r--r--net/ipv6/sit.c21
-rw-r--r--net/ipv6/tcp_ipv6.c8
-rw-r--r--net/ipv6/udp.c7
-rw-r--r--net/ipv6/xfrm6_mode_tunnel.c4
-rw-r--r--net/ipv6/xfrm6_output.c4
18 files changed, 139 insertions, 133 deletions
diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
index 1c7f400a3cfe..4aae658e5501 100644
--- a/net/ipv6/exthdrs.c
+++ b/net/ipv6/exthdrs.c
@@ -277,7 +277,7 @@ static int ipv6_destopt_rcv(struct sk_buff *skb)
277 if (!pskb_may_pull(skb, skb_transport_offset(skb) + 8) || 277 if (!pskb_may_pull(skb, skb_transport_offset(skb) + 8) ||
278 !pskb_may_pull(skb, (skb_transport_offset(skb) + 278 !pskb_may_pull(skb, (skb_transport_offset(skb) +
279 ((skb_transport_header(skb)[1] + 1) << 3)))) { 279 ((skb_transport_header(skb)[1] + 1) << 3)))) {
280 IP6_INC_STATS_BH(dev_net(skb->dst->dev), ip6_dst_idev(skb->dst), 280 IP6_INC_STATS_BH(dev_net(skb_dst(skb)->dev), ip6_dst_idev(skb_dst(skb)),
281 IPSTATS_MIB_INHDRERRORS); 281 IPSTATS_MIB_INHDRERRORS);
282 kfree_skb(skb); 282 kfree_skb(skb);
283 return -1; 283 return -1;
@@ -288,7 +288,7 @@ static int ipv6_destopt_rcv(struct sk_buff *skb)
288 dstbuf = opt->dst1; 288 dstbuf = opt->dst1;
289#endif 289#endif
290 290
291 dst = dst_clone(skb->dst); 291 dst = dst_clone(skb_dst(skb));
292 if (ip6_parse_tlv(tlvprocdestopt_lst, skb)) { 292 if (ip6_parse_tlv(tlvprocdestopt_lst, skb)) {
293 dst_release(dst); 293 dst_release(dst);
294 skb->transport_header += (skb_transport_header(skb)[1] + 1) << 3; 294 skb->transport_header += (skb_transport_header(skb)[1] + 1) << 3;
@@ -333,7 +333,7 @@ static int ipv6_rthdr_rcv(struct sk_buff *skb)
333 if (!pskb_may_pull(skb, skb_transport_offset(skb) + 8) || 333 if (!pskb_may_pull(skb, skb_transport_offset(skb) + 8) ||
334 !pskb_may_pull(skb, (skb_transport_offset(skb) + 334 !pskb_may_pull(skb, (skb_transport_offset(skb) +
335 ((skb_transport_header(skb)[1] + 1) << 3)))) { 335 ((skb_transport_header(skb)[1] + 1) << 3)))) {
336 IP6_INC_STATS_BH(net, ip6_dst_idev(skb->dst), 336 IP6_INC_STATS_BH(net, ip6_dst_idev(skb_dst(skb)),
337 IPSTATS_MIB_INHDRERRORS); 337 IPSTATS_MIB_INHDRERRORS);
338 kfree_skb(skb); 338 kfree_skb(skb);
339 return -1; 339 return -1;
@@ -343,7 +343,7 @@ static int ipv6_rthdr_rcv(struct sk_buff *skb)
343 343
344 if (ipv6_addr_is_multicast(&ipv6_hdr(skb)->daddr) || 344 if (ipv6_addr_is_multicast(&ipv6_hdr(skb)->daddr) ||
345 skb->pkt_type != PACKET_HOST) { 345 skb->pkt_type != PACKET_HOST) {
346 IP6_INC_STATS_BH(net, ip6_dst_idev(skb->dst), 346 IP6_INC_STATS_BH(net, ip6_dst_idev(skb_dst(skb)),
347 IPSTATS_MIB_INADDRERRORS); 347 IPSTATS_MIB_INADDRERRORS);
348 kfree_skb(skb); 348 kfree_skb(skb);
349 return -1; 349 return -1;
@@ -358,7 +358,7 @@ looped_back:
358 * processed by own 358 * processed by own
359 */ 359 */
360 if (!addr) { 360 if (!addr) {
361 IP6_INC_STATS_BH(net, ip6_dst_idev(skb->dst), 361 IP6_INC_STATS_BH(net, ip6_dst_idev(skb_dst(skb)),
362 IPSTATS_MIB_INADDRERRORS); 362 IPSTATS_MIB_INADDRERRORS);
363 kfree_skb(skb); 363 kfree_skb(skb);
364 return -1; 364 return -1;
@@ -384,7 +384,7 @@ looped_back:
384 goto unknown_rh; 384 goto unknown_rh;
385 /* Silently discard invalid RTH type 2 */ 385 /* Silently discard invalid RTH type 2 */
386 if (hdr->hdrlen != 2 || hdr->segments_left != 1) { 386 if (hdr->hdrlen != 2 || hdr->segments_left != 1) {
387 IP6_INC_STATS_BH(net, ip6_dst_idev(skb->dst), 387 IP6_INC_STATS_BH(net, ip6_dst_idev(skb_dst(skb)),
388 IPSTATS_MIB_INHDRERRORS); 388 IPSTATS_MIB_INHDRERRORS);
389 kfree_skb(skb); 389 kfree_skb(skb);
390 return -1; 390 return -1;
@@ -403,7 +403,7 @@ looped_back:
403 n = hdr->hdrlen >> 1; 403 n = hdr->hdrlen >> 1;
404 404
405 if (hdr->segments_left > n) { 405 if (hdr->segments_left > n) {
406 IP6_INC_STATS_BH(net, ip6_dst_idev(skb->dst), 406 IP6_INC_STATS_BH(net, ip6_dst_idev(skb_dst(skb)),
407 IPSTATS_MIB_INHDRERRORS); 407 IPSTATS_MIB_INHDRERRORS);
408 icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, 408 icmpv6_param_prob(skb, ICMPV6_HDR_FIELD,
409 ((&hdr->segments_left) - 409 ((&hdr->segments_left) -
@@ -417,7 +417,7 @@ looped_back:
417 if (skb_cloned(skb)) { 417 if (skb_cloned(skb)) {
418 /* the copy is a forwarded packet */ 418 /* the copy is a forwarded packet */
419 if (pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) { 419 if (pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) {
420 IP6_INC_STATS_BH(net, ip6_dst_idev(skb->dst), 420 IP6_INC_STATS_BH(net, ip6_dst_idev(skb_dst(skb)),
421 IPSTATS_MIB_OUTDISCARDS); 421 IPSTATS_MIB_OUTDISCARDS);
422 kfree_skb(skb); 422 kfree_skb(skb);
423 return -1; 423 return -1;
@@ -440,13 +440,13 @@ looped_back:
440 if (xfrm6_input_addr(skb, (xfrm_address_t *)addr, 440 if (xfrm6_input_addr(skb, (xfrm_address_t *)addr,
441 (xfrm_address_t *)&ipv6_hdr(skb)->saddr, 441 (xfrm_address_t *)&ipv6_hdr(skb)->saddr,
442 IPPROTO_ROUTING) < 0) { 442 IPPROTO_ROUTING) < 0) {
443 IP6_INC_STATS_BH(net, ip6_dst_idev(skb->dst), 443 IP6_INC_STATS_BH(net, ip6_dst_idev(skb_dst(skb)),
444 IPSTATS_MIB_INADDRERRORS); 444 IPSTATS_MIB_INADDRERRORS);
445 kfree_skb(skb); 445 kfree_skb(skb);
446 return -1; 446 return -1;
447 } 447 }
448 if (!ipv6_chk_home_addr(dev_net(skb->dst->dev), addr)) { 448 if (!ipv6_chk_home_addr(dev_net(skb_dst(skb)->dev), addr)) {
449 IP6_INC_STATS_BH(net, ip6_dst_idev(skb->dst), 449 IP6_INC_STATS_BH(net, ip6_dst_idev(skb_dst(skb)),
450 IPSTATS_MIB_INADDRERRORS); 450 IPSTATS_MIB_INADDRERRORS);
451 kfree_skb(skb); 451 kfree_skb(skb);
452 return -1; 452 return -1;
@@ -458,7 +458,7 @@ looped_back:
458 } 458 }
459 459
460 if (ipv6_addr_is_multicast(addr)) { 460 if (ipv6_addr_is_multicast(addr)) {
461 IP6_INC_STATS_BH(net, ip6_dst_idev(skb->dst), 461 IP6_INC_STATS_BH(net, ip6_dst_idev(skb_dst(skb)),
462 IPSTATS_MIB_INADDRERRORS); 462 IPSTATS_MIB_INADDRERRORS);
463 kfree_skb(skb); 463 kfree_skb(skb);
464 return -1; 464 return -1;
@@ -468,17 +468,17 @@ looped_back:
468 ipv6_addr_copy(addr, &ipv6_hdr(skb)->daddr); 468 ipv6_addr_copy(addr, &ipv6_hdr(skb)->daddr);
469 ipv6_addr_copy(&ipv6_hdr(skb)->daddr, &daddr); 469 ipv6_addr_copy(&ipv6_hdr(skb)->daddr, &daddr);
470 470
471 dst_release(xchg(&skb->dst, NULL)); 471 skb_dst_drop(skb);
472 ip6_route_input(skb); 472 ip6_route_input(skb);
473 if (skb->dst->error) { 473 if (skb_dst(skb)->error) {
474 skb_push(skb, skb->data - skb_network_header(skb)); 474 skb_push(skb, skb->data - skb_network_header(skb));
475 dst_input(skb); 475 dst_input(skb);
476 return -1; 476 return -1;
477 } 477 }
478 478
479 if (skb->dst->dev->flags&IFF_LOOPBACK) { 479 if (skb_dst(skb)->dev->flags&IFF_LOOPBACK) {
480 if (ipv6_hdr(skb)->hop_limit <= 1) { 480 if (ipv6_hdr(skb)->hop_limit <= 1) {
481 IP6_INC_STATS_BH(net, ip6_dst_idev(skb->dst), 481 IP6_INC_STATS_BH(net, ip6_dst_idev(skb_dst(skb)),
482 IPSTATS_MIB_INHDRERRORS); 482 IPSTATS_MIB_INHDRERRORS);
483 icmpv6_send(skb, ICMPV6_TIME_EXCEED, ICMPV6_EXC_HOPLIMIT, 483 icmpv6_send(skb, ICMPV6_TIME_EXCEED, ICMPV6_EXC_HOPLIMIT,
484 0, skb->dev); 484 0, skb->dev);
@@ -494,7 +494,7 @@ looped_back:
494 return -1; 494 return -1;
495 495
496unknown_rh: 496unknown_rh:
497 IP6_INC_STATS_BH(net, ip6_dst_idev(skb->dst), IPSTATS_MIB_INHDRERRORS); 497 IP6_INC_STATS_BH(net, ip6_dst_idev(skb_dst(skb)), IPSTATS_MIB_INHDRERRORS);
498 icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, 498 icmpv6_param_prob(skb, ICMPV6_HDR_FIELD,
499 (&hdr->type) - skb_network_header(skb)); 499 (&hdr->type) - skb_network_header(skb));
500 return -1; 500 return -1;
@@ -552,11 +552,11 @@ void ipv6_exthdrs_exit(void)
552 **********************************/ 552 **********************************/
553 553
554/* 554/*
555 * Note: we cannot rely on skb->dst before we assign it in ip6_route_input(). 555 * Note: we cannot rely on skb_dst(skb) before we assign it in ip6_route_input().
556 */ 556 */
557static inline struct inet6_dev *ipv6_skb_idev(struct sk_buff *skb) 557static inline struct inet6_dev *ipv6_skb_idev(struct sk_buff *skb)
558{ 558{
559 return skb->dst ? ip6_dst_idev(skb->dst) : __in6_dev_get(skb->dev); 559 return skb_dst(skb) ? ip6_dst_idev(skb_dst(skb)) : __in6_dev_get(skb->dev);
560} 560}
561 561
562/* Router Alert as of RFC 2711 */ 562/* Router Alert as of RFC 2711 */
@@ -581,7 +581,7 @@ static int ipv6_hop_jumbo(struct sk_buff *skb, int optoff)
581{ 581{
582 const unsigned char *nh = skb_network_header(skb); 582 const unsigned char *nh = skb_network_header(skb);
583 u32 pkt_len; 583 u32 pkt_len;
584 struct net *net = dev_net(skb->dst->dev); 584 struct net *net = dev_net(skb_dst(skb)->dev);
585 585
586 if (nh[optoff + 1] != 4 || (optoff & 3) != 2) { 586 if (nh[optoff + 1] != 4 || (optoff & 3) != 2) {
587 LIMIT_NETDEBUG(KERN_DEBUG "ipv6_hop_jumbo: wrong jumbo opt length/alignment %d\n", 587 LIMIT_NETDEBUG(KERN_DEBUG "ipv6_hop_jumbo: wrong jumbo opt length/alignment %d\n",
diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c
index 3c3732d50c1a..cc4797dd8325 100644
--- a/net/ipv6/inet6_connection_sock.c
+++ b/net/ipv6/inet6_connection_sock.c
@@ -228,7 +228,7 @@ int inet6_csk_xmit(struct sk_buff *skb, int ipfragok)
228 __inet6_csk_dst_store(sk, dst, NULL, NULL); 228 __inet6_csk_dst_store(sk, dst, NULL, NULL);
229 } 229 }
230 230
231 skb->dst = dst_clone(dst); 231 skb_dst_set(skb, dst_clone(dst));
232 232
233 /* Restore final destination back after routing done */ 233 /* Restore final destination back after routing done */
234 ipv6_addr_copy(&fl.fl6_dst, &np->daddr); 234 ipv6_addr_copy(&fl.fl6_dst, &np->daddr);
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
index bc1a920c34a1..c3a07d75b5f5 100644
--- a/net/ipv6/ip6_input.c
+++ b/net/ipv6/ip6_input.c
@@ -48,7 +48,7 @@
48 48
49inline int ip6_rcv_finish( struct sk_buff *skb) 49inline int ip6_rcv_finish( struct sk_buff *skb)
50{ 50{
51 if (skb->dst == NULL) 51 if (skb_dst(skb) == NULL)
52 ip6_route_input(skb); 52 ip6_route_input(skb);
53 53
54 return dst_input(skb); 54 return dst_input(skb);
@@ -91,7 +91,7 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt
91 * arrived via the sending interface (ethX), because of the 91 * arrived via the sending interface (ethX), because of the
92 * nature of scoping architecture. --yoshfuji 92 * nature of scoping architecture. --yoshfuji
93 */ 93 */
94 IP6CB(skb)->iif = skb->dst ? ip6_dst_idev(skb->dst)->dev->ifindex : dev->ifindex; 94 IP6CB(skb)->iif = skb_dst(skb) ? ip6_dst_idev(skb_dst(skb))->dev->ifindex : dev->ifindex;
95 95
96 if (unlikely(!pskb_may_pull(skb, sizeof(*hdr)))) 96 if (unlikely(!pskb_may_pull(skb, sizeof(*hdr))))
97 goto err; 97 goto err;
@@ -161,7 +161,7 @@ static int ip6_input_finish(struct sk_buff *skb)
161 int nexthdr, raw; 161 int nexthdr, raw;
162 u8 hash; 162 u8 hash;
163 struct inet6_dev *idev; 163 struct inet6_dev *idev;
164 struct net *net = dev_net(skb->dst->dev); 164 struct net *net = dev_net(skb_dst(skb)->dev);
165 165
166 /* 166 /*
167 * Parse extension headers 167 * Parse extension headers
@@ -169,7 +169,7 @@ static int ip6_input_finish(struct sk_buff *skb)
169 169
170 rcu_read_lock(); 170 rcu_read_lock();
171resubmit: 171resubmit:
172 idev = ip6_dst_idev(skb->dst); 172 idev = ip6_dst_idev(skb_dst(skb));
173 if (!pskb_pull(skb, skb_transport_offset(skb))) 173 if (!pskb_pull(skb, skb_transport_offset(skb)))
174 goto discard; 174 goto discard;
175 nhoff = IP6CB(skb)->nhoff; 175 nhoff = IP6CB(skb)->nhoff;
@@ -242,8 +242,8 @@ int ip6_mc_input(struct sk_buff *skb)
242 struct ipv6hdr *hdr; 242 struct ipv6hdr *hdr;
243 int deliver; 243 int deliver;
244 244
245 IP6_UPD_PO_STATS_BH(dev_net(skb->dst->dev), 245 IP6_UPD_PO_STATS_BH(dev_net(skb_dst(skb)->dev),
246 ip6_dst_idev(skb->dst), IPSTATS_MIB_INMCAST, 246 ip6_dst_idev(skb_dst(skb)), IPSTATS_MIB_INMCAST,
247 skb->len); 247 skb->len);
248 248
249 hdr = ipv6_hdr(skb); 249 hdr = ipv6_hdr(skb);
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 735a2bf4b5f1..c8dc8e5a822f 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -78,7 +78,7 @@ int __ip6_local_out(struct sk_buff *skb)
78 len = 0; 78 len = 0;
79 ipv6_hdr(skb)->payload_len = htons(len); 79 ipv6_hdr(skb)->payload_len = htons(len);
80 80
81 return nf_hook(PF_INET6, NF_INET_LOCAL_OUT, skb, NULL, skb->dst->dev, 81 return nf_hook(PF_INET6, NF_INET_LOCAL_OUT, skb, NULL, skb_dst(skb)->dev,
82 dst_output); 82 dst_output);
83} 83}
84 84
@@ -96,7 +96,7 @@ EXPORT_SYMBOL_GPL(ip6_local_out);
96 96
97static int ip6_output_finish(struct sk_buff *skb) 97static int ip6_output_finish(struct sk_buff *skb)
98{ 98{
99 struct dst_entry *dst = skb->dst; 99 struct dst_entry *dst = skb_dst(skb);
100 100
101 if (dst->hh) 101 if (dst->hh)
102 return neigh_hh_output(dst->hh, skb); 102 return neigh_hh_output(dst->hh, skb);
@@ -117,7 +117,7 @@ static int ip6_dev_loopback_xmit(struct sk_buff *newskb)
117 __skb_pull(newskb, skb_network_offset(newskb)); 117 __skb_pull(newskb, skb_network_offset(newskb));
118 newskb->pkt_type = PACKET_LOOPBACK; 118 newskb->pkt_type = PACKET_LOOPBACK;
119 newskb->ip_summed = CHECKSUM_UNNECESSARY; 119 newskb->ip_summed = CHECKSUM_UNNECESSARY;
120 WARN_ON(!newskb->dst); 120 WARN_ON(!skb_dst(newskb));
121 121
122 netif_rx(newskb); 122 netif_rx(newskb);
123 return 0; 123 return 0;
@@ -126,7 +126,7 @@ static int ip6_dev_loopback_xmit(struct sk_buff *newskb)
126 126
127static int ip6_output2(struct sk_buff *skb) 127static int ip6_output2(struct sk_buff *skb)
128{ 128{
129 struct dst_entry *dst = skb->dst; 129 struct dst_entry *dst = skb_dst(skb);
130 struct net_device *dev = dst->dev; 130 struct net_device *dev = dst->dev;
131 131
132 skb->protocol = htons(ETH_P_IPV6); 132 skb->protocol = htons(ETH_P_IPV6);
@@ -134,7 +134,7 @@ static int ip6_output2(struct sk_buff *skb)
134 134
135 if (ipv6_addr_is_multicast(&ipv6_hdr(skb)->daddr)) { 135 if (ipv6_addr_is_multicast(&ipv6_hdr(skb)->daddr)) {
136 struct ipv6_pinfo* np = skb->sk ? inet6_sk(skb->sk) : NULL; 136 struct ipv6_pinfo* np = skb->sk ? inet6_sk(skb->sk) : NULL;
137 struct inet6_dev *idev = ip6_dst_idev(skb->dst); 137 struct inet6_dev *idev = ip6_dst_idev(skb_dst(skb));
138 138
139 if (!(dev->flags & IFF_LOOPBACK) && (!np || np->mc_loop) && 139 if (!(dev->flags & IFF_LOOPBACK) && (!np || np->mc_loop) &&
140 ((mroute6_socket(dev_net(dev)) && 140 ((mroute6_socket(dev_net(dev)) &&
@@ -172,21 +172,21 @@ static inline int ip6_skb_dst_mtu(struct sk_buff *skb)
172 struct ipv6_pinfo *np = skb->sk ? inet6_sk(skb->sk) : NULL; 172 struct ipv6_pinfo *np = skb->sk ? inet6_sk(skb->sk) : NULL;
173 173
174 return (np && np->pmtudisc == IPV6_PMTUDISC_PROBE) ? 174 return (np && np->pmtudisc == IPV6_PMTUDISC_PROBE) ?
175 skb->dst->dev->mtu : dst_mtu(skb->dst); 175 skb_dst(skb)->dev->mtu : dst_mtu(skb_dst(skb));
176} 176}
177 177
178int ip6_output(struct sk_buff *skb) 178int ip6_output(struct sk_buff *skb)
179{ 179{
180 struct inet6_dev *idev = ip6_dst_idev(skb->dst); 180 struct inet6_dev *idev = ip6_dst_idev(skb_dst(skb));
181 if (unlikely(idev->cnf.disable_ipv6)) { 181 if (unlikely(idev->cnf.disable_ipv6)) {
182 IP6_INC_STATS(dev_net(skb->dst->dev), idev, 182 IP6_INC_STATS(dev_net(skb_dst(skb)->dev), idev,
183 IPSTATS_MIB_OUTDISCARDS); 183 IPSTATS_MIB_OUTDISCARDS);
184 kfree_skb(skb); 184 kfree_skb(skb);
185 return 0; 185 return 0;
186 } 186 }
187 187
188 if ((skb->len > ip6_skb_dst_mtu(skb) && !skb_is_gso(skb)) || 188 if ((skb->len > ip6_skb_dst_mtu(skb) && !skb_is_gso(skb)) ||
189 dst_allfrag(skb->dst)) 189 dst_allfrag(skb_dst(skb)))
190 return ip6_fragment(skb, ip6_output2); 190 return ip6_fragment(skb, ip6_output2);
191 else 191 else
192 return ip6_output2(skb); 192 return ip6_output2(skb);
@@ -202,7 +202,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
202 struct net *net = sock_net(sk); 202 struct net *net = sock_net(sk);
203 struct ipv6_pinfo *np = inet6_sk(sk); 203 struct ipv6_pinfo *np = inet6_sk(sk);
204 struct in6_addr *first_hop = &fl->fl6_dst; 204 struct in6_addr *first_hop = &fl->fl6_dst;
205 struct dst_entry *dst = skb->dst; 205 struct dst_entry *dst = skb_dst(skb);
206 struct ipv6hdr *hdr; 206 struct ipv6hdr *hdr;
207 u8 proto = fl->proto; 207 u8 proto = fl->proto;
208 int seg_len = skb->len; 208 int seg_len = skb->len;
@@ -222,7 +222,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
222 if (skb_headroom(skb) < head_room) { 222 if (skb_headroom(skb) < head_room) {
223 struct sk_buff *skb2 = skb_realloc_headroom(skb, head_room); 223 struct sk_buff *skb2 = skb_realloc_headroom(skb, head_room);
224 if (skb2 == NULL) { 224 if (skb2 == NULL) {
225 IP6_INC_STATS(net, ip6_dst_idev(skb->dst), 225 IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)),
226 IPSTATS_MIB_OUTDISCARDS); 226 IPSTATS_MIB_OUTDISCARDS);
227 kfree_skb(skb); 227 kfree_skb(skb);
228 return -ENOBUFS; 228 return -ENOBUFS;
@@ -276,7 +276,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
276 276
277 mtu = dst_mtu(dst); 277 mtu = dst_mtu(dst);
278 if ((skb->len <= mtu) || skb->local_df || skb_is_gso(skb)) { 278 if ((skb->len <= mtu) || skb->local_df || skb_is_gso(skb)) {
279 IP6_UPD_PO_STATS(net, ip6_dst_idev(skb->dst), 279 IP6_UPD_PO_STATS(net, ip6_dst_idev(skb_dst(skb)),
280 IPSTATS_MIB_OUT, skb->len); 280 IPSTATS_MIB_OUT, skb->len);
281 return NF_HOOK(PF_INET6, NF_INET_LOCAL_OUT, skb, NULL, dst->dev, 281 return NF_HOOK(PF_INET6, NF_INET_LOCAL_OUT, skb, NULL, dst->dev,
282 dst_output); 282 dst_output);
@@ -286,7 +286,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
286 printk(KERN_DEBUG "IPv6: sending pkt_too_big to self\n"); 286 printk(KERN_DEBUG "IPv6: sending pkt_too_big to self\n");
287 skb->dev = dst->dev; 287 skb->dev = dst->dev;
288 icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, skb->dev); 288 icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, skb->dev);
289 IP6_INC_STATS(net, ip6_dst_idev(skb->dst), IPSTATS_MIB_FRAGFAILS); 289 IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)), IPSTATS_MIB_FRAGFAILS);
290 kfree_skb(skb); 290 kfree_skb(skb);
291 return -EMSGSIZE; 291 return -EMSGSIZE;
292} 292}
@@ -416,7 +416,7 @@ static inline int ip6_forward_finish(struct sk_buff *skb)
416 416
417int ip6_forward(struct sk_buff *skb) 417int ip6_forward(struct sk_buff *skb)
418{ 418{
419 struct dst_entry *dst = skb->dst; 419 struct dst_entry *dst = skb_dst(skb);
420 struct ipv6hdr *hdr = ipv6_hdr(skb); 420 struct ipv6hdr *hdr = ipv6_hdr(skb);
421 struct inet6_skb_parm *opt = IP6CB(skb); 421 struct inet6_skb_parm *opt = IP6CB(skb);
422 struct net *net = dev_net(dst->dev); 422 struct net *net = dev_net(dst->dev);
@@ -485,7 +485,7 @@ int ip6_forward(struct sk_buff *skb)
485 IP6_INC_STATS(net, ip6_dst_idev(dst), IPSTATS_MIB_INDISCARDS); 485 IP6_INC_STATS(net, ip6_dst_idev(dst), IPSTATS_MIB_INDISCARDS);
486 goto drop; 486 goto drop;
487 } 487 }
488 dst = skb->dst; 488 dst = skb_dst(skb);
489 489
490 /* IPv6 specs say nothing about it, but it is clear that we cannot 490 /* IPv6 specs say nothing about it, but it is clear that we cannot
491 send redirects to source routed frames. 491 send redirects to source routed frames.
@@ -566,8 +566,8 @@ static void ip6_copy_metadata(struct sk_buff *to, struct sk_buff *from)
566 to->pkt_type = from->pkt_type; 566 to->pkt_type = from->pkt_type;
567 to->priority = from->priority; 567 to->priority = from->priority;
568 to->protocol = from->protocol; 568 to->protocol = from->protocol;
569 dst_release(to->dst); 569 skb_dst_drop(to);
570 to->dst = dst_clone(from->dst); 570 skb_dst_set(to, dst_clone(skb_dst(from)));
571 to->dev = from->dev; 571 to->dev = from->dev;
572 to->mark = from->mark; 572 to->mark = from->mark;
573 573
@@ -624,7 +624,7 @@ int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr)
624static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)) 624static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
625{ 625{
626 struct sk_buff *frag; 626 struct sk_buff *frag;
627 struct rt6_info *rt = (struct rt6_info*)skb->dst; 627 struct rt6_info *rt = (struct rt6_info*)skb_dst(skb);
628 struct ipv6_pinfo *np = skb->sk ? inet6_sk(skb->sk) : NULL; 628 struct ipv6_pinfo *np = skb->sk ? inet6_sk(skb->sk) : NULL;
629 struct ipv6hdr *tmp_hdr; 629 struct ipv6hdr *tmp_hdr;
630 struct frag_hdr *fh; 630 struct frag_hdr *fh;
@@ -632,7 +632,7 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
632 __be32 frag_id = 0; 632 __be32 frag_id = 0;
633 int ptr, offset = 0, err=0; 633 int ptr, offset = 0, err=0;
634 u8 *prevhdr, nexthdr = 0; 634 u8 *prevhdr, nexthdr = 0;
635 struct net *net = dev_net(skb->dst->dev); 635 struct net *net = dev_net(skb_dst(skb)->dev);
636 636
637 hlen = ip6_find_1stfragopt(skb, &prevhdr); 637 hlen = ip6_find_1stfragopt(skb, &prevhdr);
638 nexthdr = *prevhdr; 638 nexthdr = *prevhdr;
@@ -644,9 +644,9 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
644 * check should be redundant, but it's free.) 644 * check should be redundant, but it's free.)
645 */ 645 */
646 if (!skb->local_df) { 646 if (!skb->local_df) {
647 skb->dev = skb->dst->dev; 647 skb->dev = skb_dst(skb)->dev;
648 icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, skb->dev); 648 icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, skb->dev);
649 IP6_INC_STATS(net, ip6_dst_idev(skb->dst), 649 IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)),
650 IPSTATS_MIB_FRAGFAILS); 650 IPSTATS_MIB_FRAGFAILS);
651 kfree_skb(skb); 651 kfree_skb(skb);
652 return -EMSGSIZE; 652 return -EMSGSIZE;
@@ -696,7 +696,7 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
696 *prevhdr = NEXTHDR_FRAGMENT; 696 *prevhdr = NEXTHDR_FRAGMENT;
697 tmp_hdr = kmemdup(skb_network_header(skb), hlen, GFP_ATOMIC); 697 tmp_hdr = kmemdup(skb_network_header(skb), hlen, GFP_ATOMIC);
698 if (!tmp_hdr) { 698 if (!tmp_hdr) {
699 IP6_INC_STATS(net, ip6_dst_idev(skb->dst), 699 IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)),
700 IPSTATS_MIB_FRAGFAILS); 700 IPSTATS_MIB_FRAGFAILS);
701 return -ENOMEM; 701 return -ENOMEM;
702 } 702 }
@@ -809,7 +809,7 @@ slow_path:
809 809
810 if ((frag = alloc_skb(len+hlen+sizeof(struct frag_hdr)+LL_ALLOCATED_SPACE(rt->u.dst.dev), GFP_ATOMIC)) == NULL) { 810 if ((frag = alloc_skb(len+hlen+sizeof(struct frag_hdr)+LL_ALLOCATED_SPACE(rt->u.dst.dev), GFP_ATOMIC)) == NULL) {
811 NETDEBUG(KERN_INFO "IPv6: frag: no memory for new fragment!\n"); 811 NETDEBUG(KERN_INFO "IPv6: frag: no memory for new fragment!\n");
812 IP6_INC_STATS(net, ip6_dst_idev(skb->dst), 812 IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)),
813 IPSTATS_MIB_FRAGFAILS); 813 IPSTATS_MIB_FRAGFAILS);
814 err = -ENOMEM; 814 err = -ENOMEM;
815 goto fail; 815 goto fail;
@@ -873,16 +873,16 @@ slow_path:
873 if (err) 873 if (err)
874 goto fail; 874 goto fail;
875 875
876 IP6_INC_STATS(net, ip6_dst_idev(skb->dst), 876 IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)),
877 IPSTATS_MIB_FRAGCREATES); 877 IPSTATS_MIB_FRAGCREATES);
878 } 878 }
879 IP6_INC_STATS(net, ip6_dst_idev(skb->dst), 879 IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)),
880 IPSTATS_MIB_FRAGOKS); 880 IPSTATS_MIB_FRAGOKS);
881 kfree_skb(skb); 881 kfree_skb(skb);
882 return err; 882 return err;
883 883
884fail: 884fail:
885 IP6_INC_STATS(net, ip6_dst_idev(skb->dst), 885 IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)),
886 IPSTATS_MIB_FRAGFAILS); 886 IPSTATS_MIB_FRAGFAILS);
887 kfree_skb(skb); 887 kfree_skb(skb);
888 return err; 888 return err;
@@ -1516,10 +1516,10 @@ int ip6_push_pending_frames(struct sock *sk)
1516 skb->priority = sk->sk_priority; 1516 skb->priority = sk->sk_priority;
1517 skb->mark = sk->sk_mark; 1517 skb->mark = sk->sk_mark;
1518 1518
1519 skb->dst = dst_clone(&rt->u.dst); 1519 skb_dst_set(skb, dst_clone(&rt->u.dst));
1520 IP6_UPD_PO_STATS(net, rt->rt6i_idev, IPSTATS_MIB_OUT, skb->len); 1520 IP6_UPD_PO_STATS(net, rt->rt6i_idev, IPSTATS_MIB_OUT, skb->len);
1521 if (proto == IPPROTO_ICMPV6) { 1521 if (proto == IPPROTO_ICMPV6) {
1522 struct inet6_dev *idev = ip6_dst_idev(skb->dst); 1522 struct inet6_dev *idev = ip6_dst_idev(skb_dst(skb));
1523 1523
1524 ICMP6MSGOUT_INC_STATS_BH(net, idev, icmp6_hdr(skb)->icmp6_type); 1524 ICMP6MSGOUT_INC_STATS_BH(net, idev, icmp6_hdr(skb)->icmp6_type);
1525 ICMP6_INC_STATS_BH(net, idev, ICMP6_MIB_OUTMSGS); 1525 ICMP6_INC_STATS_BH(net, idev, ICMP6_MIB_OUTMSGS);
@@ -1545,8 +1545,8 @@ void ip6_flush_pending_frames(struct sock *sk)
1545 struct sk_buff *skb; 1545 struct sk_buff *skb;
1546 1546
1547 while ((skb = __skb_dequeue_tail(&sk->sk_write_queue)) != NULL) { 1547 while ((skb = __skb_dequeue_tail(&sk->sk_write_queue)) != NULL) {
1548 if (skb->dst) 1548 if (skb_dst(skb))
1549 IP6_INC_STATS(sock_net(sk), ip6_dst_idev(skb->dst), 1549 IP6_INC_STATS(sock_net(sk), ip6_dst_idev(skb_dst(skb)),
1550 IPSTATS_MIB_OUTDISCARDS); 1550 IPSTATS_MIB_OUTDISCARDS);
1551 kfree_skb(skb); 1551 kfree_skb(skb);
1552 } 1552 }
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
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 228be551e9c1..a35d8fc55b04 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -398,10 +398,9 @@ static int pim6_rcv(struct sk_buff *skb)
398 skb->protocol = htons(ETH_P_IPV6); 398 skb->protocol = htons(ETH_P_IPV6);
399 skb->ip_summed = 0; 399 skb->ip_summed = 0;
400 skb->pkt_type = PACKET_HOST; 400 skb->pkt_type = PACKET_HOST;
401 dst_release(skb->dst); 401 skb_dst_drop(skb);
402 reg_dev->stats.rx_bytes += skb->len; 402 reg_dev->stats.rx_bytes += skb->len;
403 reg_dev->stats.rx_packets++; 403 reg_dev->stats.rx_packets++;
404 skb->dst = NULL;
405 nf_reset(skb); 404 nf_reset(skb);
406 netif_rx(skb); 405 netif_rx(skb);
407 dev_put(reg_dev); 406 dev_put(reg_dev);
@@ -849,7 +848,7 @@ static int ip6mr_cache_report(struct net *net, struct sk_buff *pkt, mifi_t mifi,
849 ipv6_addr_copy(&msg->im6_src, &ipv6_hdr(pkt)->saddr); 848 ipv6_addr_copy(&msg->im6_src, &ipv6_hdr(pkt)->saddr);
850 ipv6_addr_copy(&msg->im6_dst, &ipv6_hdr(pkt)->daddr); 849 ipv6_addr_copy(&msg->im6_dst, &ipv6_hdr(pkt)->daddr);
851 850
852 skb->dst = dst_clone(pkt->dst); 851 skb_dst_set(skb, dst_clone(skb_dst(pkt)));
853 skb->ip_summed = CHECKSUM_UNNECESSARY; 852 skb->ip_summed = CHECKSUM_UNNECESSARY;
854 } 853 }
855 854
@@ -1487,7 +1486,7 @@ int ip6mr_ioctl(struct sock *sk, int cmd, void __user *arg)
1487 1486
1488static inline int ip6mr_forward2_finish(struct sk_buff *skb) 1487static inline int ip6mr_forward2_finish(struct sk_buff *skb)
1489{ 1488{
1490 IP6_INC_STATS_BH(dev_net(skb->dst->dev), ip6_dst_idev(skb->dst), 1489 IP6_INC_STATS_BH(dev_net(skb_dst(skb)->dev), ip6_dst_idev(skb_dst(skb)),
1491 IPSTATS_MIB_OUTFORWDATAGRAMS); 1490 IPSTATS_MIB_OUTFORWDATAGRAMS);
1492 return dst_output(skb); 1491 return dst_output(skb);
1493} 1492}
@@ -1532,8 +1531,8 @@ static int ip6mr_forward2(struct sk_buff *skb, struct mfc6_cache *c, int vifi)
1532 if (!dst) 1531 if (!dst)
1533 goto out_free; 1532 goto out_free;
1534 1533
1535 dst_release(skb->dst); 1534 skb_dst_drop(skb);
1536 skb->dst = dst; 1535 skb_dst_set(skb, dst);
1537 1536
1538 /* 1537 /*
1539 * RFC1584 teaches, that DVMRP/PIM router must deliver packets locally 1538 * RFC1584 teaches, that DVMRP/PIM router must deliver packets locally
@@ -1722,7 +1721,7 @@ int ip6mr_get_route(struct net *net,
1722{ 1721{
1723 int err; 1722 int err;
1724 struct mfc6_cache *cache; 1723 struct mfc6_cache *cache;
1725 struct rt6_info *rt = (struct rt6_info *)skb->dst; 1724 struct rt6_info *rt = (struct rt6_info *)skb_dst(skb);
1726 1725
1727 read_lock(&mrt_lock); 1726 read_lock(&mrt_lock);
1728 cache = ip6mr_cache_find(net, &rt->rt6i_src.addr, &rt->rt6i_dst.addr); 1727 cache = ip6mr_cache_find(net, &rt->rt6i_src.addr, &rt->rt6i_dst.addr);
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index 4b48819a5b8d..4b264ed40a8c 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -1448,6 +1448,7 @@ static void mld_sendpack(struct sk_buff *skb)
1448 struct net *net = dev_net(skb->dev); 1448 struct net *net = dev_net(skb->dev);
1449 int err; 1449 int err;
1450 struct flowi fl; 1450 struct flowi fl;
1451 struct dst_entry *dst;
1451 1452
1452 IP6_UPD_PO_STATS(net, idev, IPSTATS_MIB_OUT, skb->len); 1453 IP6_UPD_PO_STATS(net, idev, IPSTATS_MIB_OUT, skb->len);
1453 1454
@@ -1459,9 +1460,9 @@ static void mld_sendpack(struct sk_buff *skb)
1459 IPPROTO_ICMPV6, csum_partial(skb_transport_header(skb), 1460 IPPROTO_ICMPV6, csum_partial(skb_transport_header(skb),
1460 mldlen, 0)); 1461 mldlen, 0));
1461 1462
1462 skb->dst = icmp6_dst_alloc(skb->dev, NULL, &ipv6_hdr(skb)->daddr); 1463 dst = icmp6_dst_alloc(skb->dev, NULL, &ipv6_hdr(skb)->daddr);
1463 1464
1464 if (!skb->dst) { 1465 if (!dst) {
1465 err = -ENOMEM; 1466 err = -ENOMEM;
1466 goto err_out; 1467 goto err_out;
1467 } 1468 }
@@ -1470,7 +1471,8 @@ static void mld_sendpack(struct sk_buff *skb)
1470 &ipv6_hdr(skb)->saddr, &ipv6_hdr(skb)->daddr, 1471 &ipv6_hdr(skb)->saddr, &ipv6_hdr(skb)->daddr,
1471 skb->dev->ifindex); 1472 skb->dev->ifindex);
1472 1473
1473 err = xfrm_lookup(net, &skb->dst, &fl, NULL, 0); 1474 err = xfrm_lookup(net, &dst, &fl, NULL, 0);
1475 skb_dst_set(skb, dst);
1474 if (err) 1476 if (err)
1475 goto err_out; 1477 goto err_out;
1476 1478
@@ -1775,6 +1777,7 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type)
1775 IPV6_TLV_ROUTERALERT, 2, 0, 0, 1777 IPV6_TLV_ROUTERALERT, 2, 0, 0,
1776 IPV6_TLV_PADN, 0 }; 1778 IPV6_TLV_PADN, 0 };
1777 struct flowi fl; 1779 struct flowi fl;
1780 struct dst_entry *dst;
1778 1781
1779 if (type == ICMPV6_MGM_REDUCTION) 1782 if (type == ICMPV6_MGM_REDUCTION)
1780 snd_addr = &in6addr_linklocal_allrouters; 1783 snd_addr = &in6addr_linklocal_allrouters;
@@ -1828,8 +1831,8 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type)
1828 1831
1829 idev = in6_dev_get(skb->dev); 1832 idev = in6_dev_get(skb->dev);
1830 1833
1831 skb->dst = icmp6_dst_alloc(skb->dev, NULL, &ipv6_hdr(skb)->daddr); 1834 dst = icmp6_dst_alloc(skb->dev, NULL, &ipv6_hdr(skb)->daddr);
1832 if (!skb->dst) { 1835 if (!dst) {
1833 err = -ENOMEM; 1836 err = -ENOMEM;
1834 goto err_out; 1837 goto err_out;
1835 } 1838 }
@@ -1838,11 +1841,11 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type)
1838 &ipv6_hdr(skb)->saddr, &ipv6_hdr(skb)->daddr, 1841 &ipv6_hdr(skb)->saddr, &ipv6_hdr(skb)->daddr,
1839 skb->dev->ifindex); 1842 skb->dev->ifindex);
1840 1843
1841 err = xfrm_lookup(net, &skb->dst, &fl, NULL, 0); 1844 err = xfrm_lookup(net, &dst, &fl, NULL, 0);
1842 if (err) 1845 if (err)
1843 goto err_out; 1846 goto err_out;
1844 1847
1845 1848 skb_dst_set(skb, dst);
1846 err = NF_HOOK(PF_INET6, NF_INET_LOCAL_OUT, skb, NULL, skb->dev, 1849 err = NF_HOOK(PF_INET6, NF_INET_LOCAL_OUT, skb, NULL, skb->dev,
1847 dst_output); 1850 dst_output);
1848out: 1851out:
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 1d13d9964985..9eb68e92cc18 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -530,7 +530,7 @@ void ndisc_send_skb(struct sk_buff *skb,
530 return; 530 return;
531 } 531 }
532 532
533 skb->dst = dst; 533 skb_dst_set(skb, dst);
534 534
535 idev = in6_dev_get(dst->dev); 535 idev = in6_dev_get(dst->dev);
536 IP6_UPD_PO_STATS(net, idev, IPSTATS_MIB_OUT, skb->len); 536 IP6_UPD_PO_STATS(net, idev, IPSTATS_MIB_OUT, skb->len);
@@ -1612,7 +1612,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
1612 len, IPPROTO_ICMPV6, 1612 len, IPPROTO_ICMPV6,
1613 csum_partial(icmph, len, 0)); 1613 csum_partial(icmph, len, 0));
1614 1614
1615 buff->dst = dst; 1615 skb_dst_set(buff, dst);
1616 idev = in6_dev_get(dst->dev); 1616 idev = in6_dev_get(dst->dev);
1617 IP6_UPD_PO_STATS(net, idev, IPSTATS_MIB_OUT, skb->len); 1617 IP6_UPD_PO_STATS(net, idev, IPSTATS_MIB_OUT, skb->len);
1618 err = NF_HOOK(PF_INET6, NF_INET_LOCAL_OUT, buff, NULL, dst->dev, 1618 err = NF_HOOK(PF_INET6, NF_INET_LOCAL_OUT, buff, NULL, dst->dev,
diff --git a/net/ipv6/netfilter.c b/net/ipv6/netfilter.c
index 834cea69fb53..d5ed92b14346 100644
--- a/net/ipv6/netfilter.c
+++ b/net/ipv6/netfilter.c
@@ -12,7 +12,7 @@
12 12
13int ip6_route_me_harder(struct sk_buff *skb) 13int ip6_route_me_harder(struct sk_buff *skb)
14{ 14{
15 struct net *net = dev_net(skb->dst->dev); 15 struct net *net = dev_net(skb_dst(skb)->dev);
16 struct ipv6hdr *iph = ipv6_hdr(skb); 16 struct ipv6hdr *iph = ipv6_hdr(skb);
17 struct dst_entry *dst; 17 struct dst_entry *dst;
18 struct flowi fl = { 18 struct flowi fl = {
@@ -28,9 +28,15 @@ int ip6_route_me_harder(struct sk_buff *skb)
28 28
29#ifdef CONFIG_XFRM 29#ifdef CONFIG_XFRM
30 if (!(IP6CB(skb)->flags & IP6SKB_XFRM_TRANSFORMED) && 30 if (!(IP6CB(skb)->flags & IP6SKB_XFRM_TRANSFORMED) &&
31 xfrm_decode_session(skb, &fl, AF_INET6) == 0) 31 xfrm_decode_session(skb, &fl, AF_INET6) == 0) {
32 if (xfrm_lookup(net, &skb->dst, &fl, skb->sk, 0)) 32 struct dst_entry *dst2 = skb_dst(skb);
33
34 if (xfrm_lookup(net, &dst2, &fl, skb->sk, 0)) {
35 skb_dst_set(skb, NULL);
33 return -1; 36 return -1;
37 }
38 skb_dst_set(skb, dst2);
39 }
34#endif 40#endif
35 41
36 if (dst->error) { 42 if (dst->error) {
@@ -41,9 +47,9 @@ int ip6_route_me_harder(struct sk_buff *skb)
41 } 47 }
42 48
43 /* Drop old route. */ 49 /* Drop old route. */
44 dst_release(skb->dst); 50 skb_dst_drop(skb);
45 51
46 skb->dst = dst; 52 skb_dst_set(skb, dst);
47 return 0; 53 return 0;
48} 54}
49EXPORT_SYMBOL(ip6_route_me_harder); 55EXPORT_SYMBOL(ip6_route_me_harder);
diff --git a/net/ipv6/netfilter/ip6t_REJECT.c b/net/ipv6/netfilter/ip6t_REJECT.c
index 5a2d0a41694a..5a7f00cd15ce 100644
--- a/net/ipv6/netfilter/ip6t_REJECT.c
+++ b/net/ipv6/netfilter/ip6t_REJECT.c
@@ -112,7 +112,7 @@ static void send_reset(struct net *net, struct sk_buff *oldskb)
112 return; 112 return;
113 } 113 }
114 114
115 nskb->dst = dst; 115 skb_dst_set(nskb, dst);
116 116
117 skb_reserve(nskb, hh_len + dst->header_len); 117 skb_reserve(nskb, hh_len + dst->header_len);
118 118
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index e99307fba0b1..36a090d87a3d 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -625,7 +625,7 @@ static int rawv6_send_hdrinc(struct sock *sk, void *from, int length,
625 625
626 skb->priority = sk->sk_priority; 626 skb->priority = sk->sk_priority;
627 skb->mark = sk->sk_mark; 627 skb->mark = sk->sk_mark;
628 skb->dst = dst_clone(&rt->u.dst); 628 skb_dst_set(skb, dst_clone(&rt->u.dst));
629 629
630 skb_put(skb, length); 630 skb_put(skb, length);
631 skb_reset_network_header(skb); 631 skb_reset_network_header(skb);
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index e9ac7a12f595..54a387d31e1a 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -267,7 +267,7 @@ static int ip6_frag_queue(struct frag_queue *fq, struct sk_buff *skb,
267 struct sk_buff *prev, *next; 267 struct sk_buff *prev, *next;
268 struct net_device *dev; 268 struct net_device *dev;
269 int offset, end; 269 int offset, end;
270 struct net *net = dev_net(skb->dst->dev); 270 struct net *net = dev_net(skb_dst(skb)->dev);
271 271
272 if (fq->q.last_in & INET_FRAG_COMPLETE) 272 if (fq->q.last_in & INET_FRAG_COMPLETE)
273 goto err; 273 goto err;
@@ -277,7 +277,7 @@ static int ip6_frag_queue(struct frag_queue *fq, struct sk_buff *skb,
277 ((u8 *)(fhdr + 1) - (u8 *)(ipv6_hdr(skb) + 1))); 277 ((u8 *)(fhdr + 1) - (u8 *)(ipv6_hdr(skb) + 1)));
278 278
279 if ((unsigned int)end > IPV6_MAXPLEN) { 279 if ((unsigned int)end > IPV6_MAXPLEN) {
280 IP6_INC_STATS_BH(net, ip6_dst_idev(skb->dst), 280 IP6_INC_STATS_BH(net, ip6_dst_idev(skb_dst(skb)),
281 IPSTATS_MIB_INHDRERRORS); 281 IPSTATS_MIB_INHDRERRORS);
282 icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, 282 icmpv6_param_prob(skb, ICMPV6_HDR_FIELD,
283 ((u8 *)&fhdr->frag_off - 283 ((u8 *)&fhdr->frag_off -
@@ -310,7 +310,7 @@ static int ip6_frag_queue(struct frag_queue *fq, struct sk_buff *skb,
310 /* RFC2460 says always send parameter problem in 310 /* RFC2460 says always send parameter problem in
311 * this case. -DaveM 311 * this case. -DaveM
312 */ 312 */
313 IP6_INC_STATS_BH(net, ip6_dst_idev(skb->dst), 313 IP6_INC_STATS_BH(net, ip6_dst_idev(skb_dst(skb)),
314 IPSTATS_MIB_INHDRERRORS); 314 IPSTATS_MIB_INHDRERRORS);
315 icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, 315 icmpv6_param_prob(skb, ICMPV6_HDR_FIELD,
316 offsetof(struct ipv6hdr, payload_len)); 316 offsetof(struct ipv6hdr, payload_len));
@@ -434,7 +434,7 @@ static int ip6_frag_queue(struct frag_queue *fq, struct sk_buff *skb,
434 return -1; 434 return -1;
435 435
436err: 436err:
437 IP6_INC_STATS(net, ip6_dst_idev(skb->dst), 437 IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)),
438 IPSTATS_MIB_REASMFAILS); 438 IPSTATS_MIB_REASMFAILS);
439 kfree_skb(skb); 439 kfree_skb(skb);
440 return -1; 440 return -1;
@@ -576,9 +576,9 @@ static int ipv6_frag_rcv(struct sk_buff *skb)
576 struct frag_hdr *fhdr; 576 struct frag_hdr *fhdr;
577 struct frag_queue *fq; 577 struct frag_queue *fq;
578 struct ipv6hdr *hdr = ipv6_hdr(skb); 578 struct ipv6hdr *hdr = ipv6_hdr(skb);
579 struct net *net = dev_net(skb->dst->dev); 579 struct net *net = dev_net(skb_dst(skb)->dev);
580 580
581 IP6_INC_STATS_BH(net, ip6_dst_idev(skb->dst), IPSTATS_MIB_REASMREQDS); 581 IP6_INC_STATS_BH(net, ip6_dst_idev(skb_dst(skb)), IPSTATS_MIB_REASMREQDS);
582 582
583 /* Jumbo payload inhibits frag. header */ 583 /* Jumbo payload inhibits frag. header */
584 if (hdr->payload_len==0) 584 if (hdr->payload_len==0)
@@ -595,17 +595,17 @@ static int ipv6_frag_rcv(struct sk_buff *skb)
595 /* It is not a fragmented frame */ 595 /* It is not a fragmented frame */
596 skb->transport_header += sizeof(struct frag_hdr); 596 skb->transport_header += sizeof(struct frag_hdr);
597 IP6_INC_STATS_BH(net, 597 IP6_INC_STATS_BH(net,
598 ip6_dst_idev(skb->dst), IPSTATS_MIB_REASMOKS); 598 ip6_dst_idev(skb_dst(skb)), IPSTATS_MIB_REASMOKS);
599 599
600 IP6CB(skb)->nhoff = (u8 *)fhdr - skb_network_header(skb); 600 IP6CB(skb)->nhoff = (u8 *)fhdr - skb_network_header(skb);
601 return 1; 601 return 1;
602 } 602 }
603 603
604 if (atomic_read(&net->ipv6.frags.mem) > net->ipv6.frags.high_thresh) 604 if (atomic_read(&net->ipv6.frags.mem) > net->ipv6.frags.high_thresh)
605 ip6_evictor(net, ip6_dst_idev(skb->dst)); 605 ip6_evictor(net, ip6_dst_idev(skb_dst(skb)));
606 606
607 if ((fq = fq_find(net, fhdr->identification, &hdr->saddr, &hdr->daddr, 607 if ((fq = fq_find(net, fhdr->identification, &hdr->saddr, &hdr->daddr,
608 ip6_dst_idev(skb->dst))) != NULL) { 608 ip6_dst_idev(skb_dst(skb)))) != NULL) {
609 int ret; 609 int ret;
610 610
611 spin_lock(&fq->q.lock); 611 spin_lock(&fq->q.lock);
@@ -617,12 +617,12 @@ static int ipv6_frag_rcv(struct sk_buff *skb)
617 return ret; 617 return ret;
618 } 618 }
619 619
620 IP6_INC_STATS_BH(net, ip6_dst_idev(skb->dst), IPSTATS_MIB_REASMFAILS); 620 IP6_INC_STATS_BH(net, ip6_dst_idev(skb_dst(skb)), IPSTATS_MIB_REASMFAILS);
621 kfree_skb(skb); 621 kfree_skb(skb);
622 return -1; 622 return -1;
623 623
624fail_hdr: 624fail_hdr:
625 IP6_INC_STATS(net, ip6_dst_idev(skb->dst), IPSTATS_MIB_INHDRERRORS); 625 IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)), IPSTATS_MIB_INHDRERRORS);
626 icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, skb_network_header_len(skb)); 626 icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, skb_network_header_len(skb));
627 return -1; 627 return -1;
628} 628}
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 032a5ec391c5..658293ea05ba 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -800,7 +800,7 @@ void ip6_route_input(struct sk_buff *skb)
800 if (rt6_need_strict(&iph->daddr) && skb->dev->type != ARPHRD_PIMREG) 800 if (rt6_need_strict(&iph->daddr) && skb->dev->type != ARPHRD_PIMREG)
801 flags |= RT6_LOOKUP_F_IFACE; 801 flags |= RT6_LOOKUP_F_IFACE;
802 802
803 skb->dst = fib6_rule_lookup(net, &fl, flags, ip6_pol_route_input); 803 skb_dst_set(skb, fib6_rule_lookup(net, &fl, flags, ip6_pol_route_input));
804} 804}
805 805
806static struct rt6_info *ip6_pol_route_output(struct net *net, struct fib6_table *table, 806static struct rt6_info *ip6_pol_route_output(struct net *net, struct fib6_table *table,
@@ -911,7 +911,7 @@ static void ip6_link_failure(struct sk_buff *skb)
911 911
912 icmpv6_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_ADDR_UNREACH, 0, skb->dev); 912 icmpv6_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_ADDR_UNREACH, 0, skb->dev);
913 913
914 rt = (struct rt6_info *) skb->dst; 914 rt = (struct rt6_info *) skb_dst(skb);
915 if (rt) { 915 if (rt) {
916 if (rt->rt6i_flags&RTF_CACHE) { 916 if (rt->rt6i_flags&RTF_CACHE) {
917 dst_set_expires(&rt->u.dst, 0); 917 dst_set_expires(&rt->u.dst, 0);
@@ -1868,7 +1868,7 @@ int ipv6_route_ioctl(struct net *net, unsigned int cmd, void __user *arg)
1868static int ip6_pkt_drop(struct sk_buff *skb, int code, int ipstats_mib_noroutes) 1868static int ip6_pkt_drop(struct sk_buff *skb, int code, int ipstats_mib_noroutes)
1869{ 1869{
1870 int type; 1870 int type;
1871 struct dst_entry *dst = skb->dst; 1871 struct dst_entry *dst = skb_dst(skb);
1872 switch (ipstats_mib_noroutes) { 1872 switch (ipstats_mib_noroutes) {
1873 case IPSTATS_MIB_INNOROUTES: 1873 case IPSTATS_MIB_INNOROUTES:
1874 type = ipv6_addr_type(&ipv6_hdr(skb)->daddr); 1874 type = ipv6_addr_type(&ipv6_hdr(skb)->daddr);
@@ -1895,7 +1895,7 @@ static int ip6_pkt_discard(struct sk_buff *skb)
1895 1895
1896static int ip6_pkt_discard_out(struct sk_buff *skb) 1896static int ip6_pkt_discard_out(struct sk_buff *skb)
1897{ 1897{
1898 skb->dev = skb->dst->dev; 1898 skb->dev = skb_dst(skb)->dev;
1899 return ip6_pkt_drop(skb, ICMPV6_NOROUTE, IPSTATS_MIB_OUTNOROUTES); 1899 return ip6_pkt_drop(skb, ICMPV6_NOROUTE, IPSTATS_MIB_OUTNOROUTES);
1900} 1900}
1901 1901
@@ -1908,7 +1908,7 @@ static int ip6_pkt_prohibit(struct sk_buff *skb)
1908 1908
1909static int ip6_pkt_prohibit_out(struct sk_buff *skb) 1909static int ip6_pkt_prohibit_out(struct sk_buff *skb)
1910{ 1910{
1911 skb->dev = skb->dst->dev; 1911 skb->dev = skb_dst(skb)->dev;
1912 return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_OUTNOROUTES); 1912 return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_OUTNOROUTES);
1913} 1913}
1914 1914
@@ -2366,7 +2366,7 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void
2366 skb_reserve(skb, MAX_HEADER + sizeof(struct ipv6hdr)); 2366 skb_reserve(skb, MAX_HEADER + sizeof(struct ipv6hdr));
2367 2367
2368 rt = (struct rt6_info*) ip6_route_output(net, NULL, &fl); 2368 rt = (struct rt6_info*) ip6_route_output(net, NULL, &fl);
2369 skb->dst = &rt->u.dst; 2369 skb_dst_set(skb, &rt->u.dst);
2370 2370
2371 err = rt6_fill_node(net, skb, rt, &fl.fl6_dst, &fl.fl6_src, iif, 2371 err = rt6_fill_node(net, skb, rt, &fl.fl6_dst, &fl.fl6_src, iif,
2372 RTM_NEWROUTE, NETLINK_CB(in_skb).pid, 2372 RTM_NEWROUTE, NETLINK_CB(in_skb).pid,
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index b3a59bd40f01..68e52308e552 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -575,8 +575,7 @@ static int ipip6_rcv(struct sk_buff *skb)
575 tunnel->dev->stats.rx_packets++; 575 tunnel->dev->stats.rx_packets++;
576 tunnel->dev->stats.rx_bytes += skb->len; 576 tunnel->dev->stats.rx_bytes += skb->len;
577 skb->dev = tunnel->dev; 577 skb->dev = tunnel->dev;
578 dst_release(skb->dst); 578 skb_dst_drop(skb);
579 skb->dst = NULL;
580 nf_reset(skb); 579 nf_reset(skb);
581 ipip6_ecn_decapsulate(iph, skb); 580 ipip6_ecn_decapsulate(iph, skb);
582 netif_rx(skb); 581 netif_rx(skb);
@@ -638,8 +637,8 @@ static int ipip6_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
638 if (dev->priv_flags & IFF_ISATAP) { 637 if (dev->priv_flags & IFF_ISATAP) {
639 struct neighbour *neigh = NULL; 638 struct neighbour *neigh = NULL;
640 639
641 if (skb->dst) 640 if (skb_dst(skb))
642 neigh = skb->dst->neighbour; 641 neigh = skb_dst(skb)->neighbour;
643 642
644 if (neigh == NULL) { 643 if (neigh == NULL) {
645 if (net_ratelimit()) 644 if (net_ratelimit())
@@ -663,8 +662,8 @@ static int ipip6_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
663 if (!dst) { 662 if (!dst) {
664 struct neighbour *neigh = NULL; 663 struct neighbour *neigh = NULL;
665 664
666 if (skb->dst) 665 if (skb_dst(skb))
667 neigh = skb->dst->neighbour; 666 neigh = skb_dst(skb)->neighbour;
668 667
669 if (neigh == NULL) { 668 if (neigh == NULL) {
670 if (net_ratelimit()) 669 if (net_ratelimit())
@@ -714,7 +713,7 @@ static int ipip6_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
714 if (tiph->frag_off) 713 if (tiph->frag_off)
715 mtu = dst_mtu(&rt->u.dst) - sizeof(struct iphdr); 714 mtu = dst_mtu(&rt->u.dst) - sizeof(struct iphdr);
716 else 715 else
717 mtu = skb->dst ? dst_mtu(skb->dst) : dev->mtu; 716 mtu = skb_dst(skb) ? dst_mtu(skb_dst(skb)) : dev->mtu;
718 717
719 if (mtu < 68) { 718 if (mtu < 68) {
720 stats->collisions++; 719 stats->collisions++;
@@ -723,8 +722,8 @@ static int ipip6_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
723 } 722 }
724 if (mtu < IPV6_MIN_MTU) 723 if (mtu < IPV6_MIN_MTU)
725 mtu = IPV6_MIN_MTU; 724 mtu = IPV6_MIN_MTU;
726 if (tunnel->parms.iph.daddr && skb->dst) 725 if (tunnel->parms.iph.daddr && skb_dst(skb))
727 skb->dst->ops->update_pmtu(skb->dst, mtu); 726 skb_dst(skb)->ops->update_pmtu(skb_dst(skb), mtu);
728 727
729 if (skb->len > mtu) { 728 if (skb->len > mtu) {
730 icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, dev); 729 icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, dev);
@@ -768,8 +767,8 @@ static int ipip6_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
768 skb_reset_network_header(skb); 767 skb_reset_network_header(skb);
769 memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); 768 memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
770 IPCB(skb)->flags = 0; 769 IPCB(skb)->flags = 0;
771 dst_release(skb->dst); 770 skb_dst_drop(skb);
772 skb->dst = &rt->u.dst; 771 skb_dst_set(skb, &rt->u.dst);
773 772
774 /* 773 /*
775 * Push down and install the IPIP header. 774 * Push down and install the IPIP header.
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index ea37741062a9..53b6a4192b16 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -981,9 +981,10 @@ static void tcp_v6_send_response(struct sk_buff *skb, u32 seq, u32 ack, u32 win,
981 struct tcphdr *th = tcp_hdr(skb), *t1; 981 struct tcphdr *th = tcp_hdr(skb), *t1;
982 struct sk_buff *buff; 982 struct sk_buff *buff;
983 struct flowi fl; 983 struct flowi fl;
984 struct net *net = dev_net(skb->dst->dev); 984 struct net *net = dev_net(skb_dst(skb)->dev);
985 struct sock *ctl_sk = net->ipv6.tcp_sk; 985 struct sock *ctl_sk = net->ipv6.tcp_sk;
986 unsigned int tot_len = sizeof(struct tcphdr); 986 unsigned int tot_len = sizeof(struct tcphdr);
987 struct dst_entry *dst;
987 __be32 *topt; 988 __be32 *topt;
988 989
989 if (ts) 990 if (ts)
@@ -1052,8 +1053,9 @@ static void tcp_v6_send_response(struct sk_buff *skb, u32 seq, u32 ack, u32 win,
1052 * Underlying function will use this to retrieve the network 1053 * Underlying function will use this to retrieve the network
1053 * namespace 1054 * namespace
1054 */ 1055 */
1055 if (!ip6_dst_lookup(ctl_sk, &buff->dst, &fl)) { 1056 if (!ip6_dst_lookup(ctl_sk, &dst, &fl)) {
1056 if (xfrm_lookup(net, &buff->dst, &fl, NULL, 0) >= 0) { 1057 if (xfrm_lookup(net, &dst, &fl, NULL, 0) >= 0) {
1058 skb_dst_set(buff, dst);
1057 ip6_xmit(ctl_sk, buff, &fl, NULL, 0); 1059 ip6_xmit(ctl_sk, buff, &fl, NULL, 0);
1058 TCP_INC_STATS_BH(net, TCP_MIB_OUTSEGS); 1060 TCP_INC_STATS_BH(net, TCP_MIB_OUTSEGS);
1059 if (rst) 1061 if (rst)
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 8905712cfbb8..fc333d854728 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -177,10 +177,9 @@ static struct sock *__udp6_lib_lookup_skb(struct sk_buff *skb,
177 177
178 if (unlikely(sk = skb_steal_sock(skb))) 178 if (unlikely(sk = skb_steal_sock(skb)))
179 return sk; 179 return sk;
180 else 180 return __udp6_lib_lookup(dev_net(skb_dst(skb)->dev), &iph->saddr, sport,
181 return __udp6_lib_lookup(dev_net(skb->dst->dev), &iph->saddr, sport, 181 &iph->daddr, dport, inet6_iif(skb),
182 &iph->daddr, dport, inet6_iif(skb), 182 udptable);
183 udptable);
184} 183}
185 184
186/* 185/*
diff --git a/net/ipv6/xfrm6_mode_tunnel.c b/net/ipv6/xfrm6_mode_tunnel.c
index e20529b4c825..3927832227b9 100644
--- a/net/ipv6/xfrm6_mode_tunnel.c
+++ b/net/ipv6/xfrm6_mode_tunnel.c
@@ -31,7 +31,7 @@ static inline void ipip6_ecn_decapsulate(struct sk_buff *skb)
31 */ 31 */
32static int xfrm6_mode_tunnel_output(struct xfrm_state *x, struct sk_buff *skb) 32static int xfrm6_mode_tunnel_output(struct xfrm_state *x, struct sk_buff *skb)
33{ 33{
34 struct dst_entry *dst = skb->dst; 34 struct dst_entry *dst = skb_dst(skb);
35 struct ipv6hdr *top_iph; 35 struct ipv6hdr *top_iph;
36 int dsfield; 36 int dsfield;
37 37
@@ -45,7 +45,7 @@ static int xfrm6_mode_tunnel_output(struct xfrm_state *x, struct sk_buff *skb)
45 45
46 memcpy(top_iph->flow_lbl, XFRM_MODE_SKB_CB(skb)->flow_lbl, 46 memcpy(top_iph->flow_lbl, XFRM_MODE_SKB_CB(skb)->flow_lbl,
47 sizeof(top_iph->flow_lbl)); 47 sizeof(top_iph->flow_lbl));
48 top_iph->nexthdr = xfrm_af2proto(skb->dst->ops->family); 48 top_iph->nexthdr = xfrm_af2proto(skb_dst(skb)->ops->family);
49 49
50 dsfield = XFRM_MODE_SKB_CB(skb)->tos; 50 dsfield = XFRM_MODE_SKB_CB(skb)->tos;
51 dsfield = INET_ECN_encapsulate(dsfield, dsfield); 51 dsfield = INET_ECN_encapsulate(dsfield, dsfield);
diff --git a/net/ipv6/xfrm6_output.c b/net/ipv6/xfrm6_output.c
index 5ee5a031bc93..c4f4eef032a3 100644
--- a/net/ipv6/xfrm6_output.c
+++ b/net/ipv6/xfrm6_output.c
@@ -30,7 +30,7 @@ EXPORT_SYMBOL(xfrm6_find_1stfragopt);
30static int xfrm6_tunnel_check_size(struct sk_buff *skb) 30static int xfrm6_tunnel_check_size(struct sk_buff *skb)
31{ 31{
32 int mtu, ret = 0; 32 int mtu, ret = 0;
33 struct dst_entry *dst = skb->dst; 33 struct dst_entry *dst = skb_dst(skb);
34 34
35 mtu = dst_mtu(dst); 35 mtu = dst_mtu(dst);
36 if (mtu < IPV6_MIN_MTU) 36 if (mtu < IPV6_MIN_MTU)
@@ -90,6 +90,6 @@ static int xfrm6_output_finish(struct sk_buff *skb)
90 90
91int xfrm6_output(struct sk_buff *skb) 91int xfrm6_output(struct sk_buff *skb)
92{ 92{
93 return NF_HOOK(PF_INET6, NF_INET_POST_ROUTING, skb, NULL, skb->dst->dev, 93 return NF_HOOK(PF_INET6, NF_INET_POST_ROUTING, skb, NULL, skb_dst(skb)->dev,
94 xfrm6_output_finish); 94 xfrm6_output_finish);
95} 95}