aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/exthdrs.c
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2009-06-02 01:19:30 -0400
committerDavid S. Miller <davem@davemloft.net>2009-06-03 05:51:04 -0400
commitadf30907d63893e4208dfe3f5c88ae12bc2f25d5 (patch)
tree0f07542bb95de2ad537540868aba6cf87a86e17d /net/ipv6/exthdrs.c
parent511c3f92ad5b6d9f8f6464be1b4f85f0422be91a (diff)
net: skb->dst accessors
Define three accessors to get/set dst attached to a skb struct dst_entry *skb_dst(const struct sk_buff *skb) void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst) void skb_dst_drop(struct sk_buff *skb) This one should replace occurrences of : dst_release(skb->dst) skb->dst = NULL; Delete skb->dst field Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/exthdrs.c')
-rw-r--r--net/ipv6/exthdrs.c40
1 files changed, 20 insertions, 20 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",