diff options
author | Denis V. Lunev <den@openvz.org> | 2008-10-08 14:09:27 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-10-08 14:09:27 -0400 |
commit | 483a47d2fe794328d29950fe00ce26dd405d9437 (patch) | |
tree | 44a6daeb0ca377a733a1c8fcca44663ae8fd7811 /net/ipv6/exthdrs.c | |
parent | 3bd653c8455bc7991bae77968702b31c8f5df883 (diff) |
ipv6: added net argument to IP6_INC_STATS_BH
Signed-off-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/exthdrs.c')
-rw-r--r-- | net/ipv6/exthdrs.c | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c index 837c830d6d8e..6bfffec2371c 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(ip6_dst_idev(skb->dst), | 280 | IP6_INC_STATS_BH(dev_net(skb->dst->dev), ip6_dst_idev(skb->dst), |
281 | IPSTATS_MIB_INHDRERRORS); | 281 | IPSTATS_MIB_INHDRERRORS); |
282 | kfree_skb(skb); | 282 | kfree_skb(skb); |
283 | return -1; | 283 | return -1; |
@@ -301,7 +301,8 @@ static int ipv6_destopt_rcv(struct sk_buff *skb) | |||
301 | return 1; | 301 | return 1; |
302 | } | 302 | } |
303 | 303 | ||
304 | IP6_INC_STATS_BH(ip6_dst_idev(dst), IPSTATS_MIB_INHDRERRORS); | 304 | IP6_INC_STATS_BH(dev_net(dst->dev), |
305 | ip6_dst_idev(dst), IPSTATS_MIB_INHDRERRORS); | ||
305 | dst_release(dst); | 306 | dst_release(dst); |
306 | return -1; | 307 | return -1; |
307 | } | 308 | } |
@@ -319,7 +320,8 @@ static int ipv6_rthdr_rcv(struct sk_buff *skb) | |||
319 | int n, i; | 320 | int n, i; |
320 | struct ipv6_rt_hdr *hdr; | 321 | struct ipv6_rt_hdr *hdr; |
321 | struct rt0_hdr *rthdr; | 322 | struct rt0_hdr *rthdr; |
322 | int accept_source_route = dev_net(skb->dev)->ipv6.devconf_all->accept_source_route; | 323 | struct net *net = dev_net(skb->dev); |
324 | int accept_source_route = net->ipv6.devconf_all->accept_source_route; | ||
323 | 325 | ||
324 | idev = in6_dev_get(skb->dev); | 326 | idev = in6_dev_get(skb->dev); |
325 | if (idev) { | 327 | if (idev) { |
@@ -331,7 +333,7 @@ static int ipv6_rthdr_rcv(struct sk_buff *skb) | |||
331 | if (!pskb_may_pull(skb, skb_transport_offset(skb) + 8) || | 333 | if (!pskb_may_pull(skb, skb_transport_offset(skb) + 8) || |
332 | !pskb_may_pull(skb, (skb_transport_offset(skb) + | 334 | !pskb_may_pull(skb, (skb_transport_offset(skb) + |
333 | ((skb_transport_header(skb)[1] + 1) << 3)))) { | 335 | ((skb_transport_header(skb)[1] + 1) << 3)))) { |
334 | IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), | 336 | IP6_INC_STATS_BH(net, ip6_dst_idev(skb->dst), |
335 | IPSTATS_MIB_INHDRERRORS); | 337 | IPSTATS_MIB_INHDRERRORS); |
336 | kfree_skb(skb); | 338 | kfree_skb(skb); |
337 | return -1; | 339 | return -1; |
@@ -341,7 +343,7 @@ static int ipv6_rthdr_rcv(struct sk_buff *skb) | |||
341 | 343 | ||
342 | if (ipv6_addr_is_multicast(&ipv6_hdr(skb)->daddr) || | 344 | if (ipv6_addr_is_multicast(&ipv6_hdr(skb)->daddr) || |
343 | skb->pkt_type != PACKET_HOST) { | 345 | skb->pkt_type != PACKET_HOST) { |
344 | IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), | 346 | IP6_INC_STATS_BH(net, ip6_dst_idev(skb->dst), |
345 | IPSTATS_MIB_INADDRERRORS); | 347 | IPSTATS_MIB_INADDRERRORS); |
346 | kfree_skb(skb); | 348 | kfree_skb(skb); |
347 | return -1; | 349 | return -1; |
@@ -356,7 +358,7 @@ looped_back: | |||
356 | * processed by own | 358 | * processed by own |
357 | */ | 359 | */ |
358 | if (!addr) { | 360 | if (!addr) { |
359 | IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), | 361 | IP6_INC_STATS_BH(net, ip6_dst_idev(skb->dst), |
360 | IPSTATS_MIB_INADDRERRORS); | 362 | IPSTATS_MIB_INADDRERRORS); |
361 | kfree_skb(skb); | 363 | kfree_skb(skb); |
362 | return -1; | 364 | return -1; |
@@ -382,7 +384,7 @@ looped_back: | |||
382 | goto unknown_rh; | 384 | goto unknown_rh; |
383 | /* Silently discard invalid RTH type 2 */ | 385 | /* Silently discard invalid RTH type 2 */ |
384 | if (hdr->hdrlen != 2 || hdr->segments_left != 1) { | 386 | if (hdr->hdrlen != 2 || hdr->segments_left != 1) { |
385 | IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), | 387 | IP6_INC_STATS_BH(net, ip6_dst_idev(skb->dst), |
386 | IPSTATS_MIB_INHDRERRORS); | 388 | IPSTATS_MIB_INHDRERRORS); |
387 | kfree_skb(skb); | 389 | kfree_skb(skb); |
388 | return -1; | 390 | return -1; |
@@ -401,7 +403,7 @@ looped_back: | |||
401 | n = hdr->hdrlen >> 1; | 403 | n = hdr->hdrlen >> 1; |
402 | 404 | ||
403 | if (hdr->segments_left > n) { | 405 | if (hdr->segments_left > n) { |
404 | IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), | 406 | IP6_INC_STATS_BH(net, ip6_dst_idev(skb->dst), |
405 | IPSTATS_MIB_INHDRERRORS); | 407 | IPSTATS_MIB_INHDRERRORS); |
406 | icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, | 408 | icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, |
407 | ((&hdr->segments_left) - | 409 | ((&hdr->segments_left) - |
@@ -415,7 +417,7 @@ looped_back: | |||
415 | if (skb_cloned(skb)) { | 417 | if (skb_cloned(skb)) { |
416 | /* the copy is a forwarded packet */ | 418 | /* the copy is a forwarded packet */ |
417 | if (pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) { | 419 | if (pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) { |
418 | IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), | 420 | IP6_INC_STATS_BH(net, ip6_dst_idev(skb->dst), |
419 | IPSTATS_MIB_OUTDISCARDS); | 421 | IPSTATS_MIB_OUTDISCARDS); |
420 | kfree_skb(skb); | 422 | kfree_skb(skb); |
421 | return -1; | 423 | return -1; |
@@ -438,13 +440,13 @@ looped_back: | |||
438 | if (xfrm6_input_addr(skb, (xfrm_address_t *)addr, | 440 | if (xfrm6_input_addr(skb, (xfrm_address_t *)addr, |
439 | (xfrm_address_t *)&ipv6_hdr(skb)->saddr, | 441 | (xfrm_address_t *)&ipv6_hdr(skb)->saddr, |
440 | IPPROTO_ROUTING) < 0) { | 442 | IPPROTO_ROUTING) < 0) { |
441 | IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), | 443 | IP6_INC_STATS_BH(net, ip6_dst_idev(skb->dst), |
442 | IPSTATS_MIB_INADDRERRORS); | 444 | IPSTATS_MIB_INADDRERRORS); |
443 | kfree_skb(skb); | 445 | kfree_skb(skb); |
444 | return -1; | 446 | return -1; |
445 | } | 447 | } |
446 | if (!ipv6_chk_home_addr(dev_net(skb->dst->dev), addr)) { | 448 | if (!ipv6_chk_home_addr(dev_net(skb->dst->dev), addr)) { |
447 | IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), | 449 | IP6_INC_STATS_BH(net, ip6_dst_idev(skb->dst), |
448 | IPSTATS_MIB_INADDRERRORS); | 450 | IPSTATS_MIB_INADDRERRORS); |
449 | kfree_skb(skb); | 451 | kfree_skb(skb); |
450 | return -1; | 452 | return -1; |
@@ -456,7 +458,7 @@ looped_back: | |||
456 | } | 458 | } |
457 | 459 | ||
458 | if (ipv6_addr_is_multicast(addr)) { | 460 | if (ipv6_addr_is_multicast(addr)) { |
459 | IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), | 461 | IP6_INC_STATS_BH(net, ip6_dst_idev(skb->dst), |
460 | IPSTATS_MIB_INADDRERRORS); | 462 | IPSTATS_MIB_INADDRERRORS); |
461 | kfree_skb(skb); | 463 | kfree_skb(skb); |
462 | return -1; | 464 | return -1; |
@@ -476,7 +478,7 @@ looped_back: | |||
476 | 478 | ||
477 | if (skb->dst->dev->flags&IFF_LOOPBACK) { | 479 | if (skb->dst->dev->flags&IFF_LOOPBACK) { |
478 | if (ipv6_hdr(skb)->hop_limit <= 1) { | 480 | if (ipv6_hdr(skb)->hop_limit <= 1) { |
479 | IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), | 481 | IP6_INC_STATS_BH(net, ip6_dst_idev(skb->dst), |
480 | IPSTATS_MIB_INHDRERRORS); | 482 | IPSTATS_MIB_INHDRERRORS); |
481 | icmpv6_send(skb, ICMPV6_TIME_EXCEED, ICMPV6_EXC_HOPLIMIT, | 483 | icmpv6_send(skb, ICMPV6_TIME_EXCEED, ICMPV6_EXC_HOPLIMIT, |
482 | 0, skb->dev); | 484 | 0, skb->dev); |
@@ -492,7 +494,7 @@ looped_back: | |||
492 | return -1; | 494 | return -1; |
493 | 495 | ||
494 | unknown_rh: | 496 | unknown_rh: |
495 | IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_INHDRERRORS); | 497 | IP6_INC_STATS_BH(net, ip6_dst_idev(skb->dst), IPSTATS_MIB_INHDRERRORS); |
496 | icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, | 498 | icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, |
497 | (&hdr->type) - skb_network_header(skb)); | 499 | (&hdr->type) - skb_network_header(skb)); |
498 | return -1; | 500 | return -1; |
@@ -579,29 +581,33 @@ static int ipv6_hop_jumbo(struct sk_buff *skb, int optoff) | |||
579 | { | 581 | { |
580 | const unsigned char *nh = skb_network_header(skb); | 582 | const unsigned char *nh = skb_network_header(skb); |
581 | u32 pkt_len; | 583 | u32 pkt_len; |
584 | struct net *net = dev_net(skb->dst->dev); | ||
582 | 585 | ||
583 | if (nh[optoff + 1] != 4 || (optoff & 3) != 2) { | 586 | if (nh[optoff + 1] != 4 || (optoff & 3) != 2) { |
584 | 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", |
585 | nh[optoff+1]); | 588 | nh[optoff+1]); |
586 | IP6_INC_STATS_BH(ipv6_skb_idev(skb), | 589 | IP6_INC_STATS_BH(net, ipv6_skb_idev(skb), |
587 | IPSTATS_MIB_INHDRERRORS); | 590 | IPSTATS_MIB_INHDRERRORS); |
588 | goto drop; | 591 | goto drop; |
589 | } | 592 | } |
590 | 593 | ||
591 | pkt_len = ntohl(*(__be32 *)(nh + optoff + 2)); | 594 | pkt_len = ntohl(*(__be32 *)(nh + optoff + 2)); |
592 | if (pkt_len <= IPV6_MAXPLEN) { | 595 | if (pkt_len <= IPV6_MAXPLEN) { |
593 | IP6_INC_STATS_BH(ipv6_skb_idev(skb), IPSTATS_MIB_INHDRERRORS); | 596 | IP6_INC_STATS_BH(net, ipv6_skb_idev(skb), |
597 | IPSTATS_MIB_INHDRERRORS); | ||
594 | icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, optoff+2); | 598 | icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, optoff+2); |
595 | return 0; | 599 | return 0; |
596 | } | 600 | } |
597 | if (ipv6_hdr(skb)->payload_len) { | 601 | if (ipv6_hdr(skb)->payload_len) { |
598 | IP6_INC_STATS_BH(ipv6_skb_idev(skb), IPSTATS_MIB_INHDRERRORS); | 602 | IP6_INC_STATS_BH(net, ipv6_skb_idev(skb), |
603 | IPSTATS_MIB_INHDRERRORS); | ||
599 | icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, optoff); | 604 | icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, optoff); |
600 | return 0; | 605 | return 0; |
601 | } | 606 | } |
602 | 607 | ||
603 | if (pkt_len > skb->len - sizeof(struct ipv6hdr)) { | 608 | if (pkt_len > skb->len - sizeof(struct ipv6hdr)) { |
604 | IP6_INC_STATS_BH(ipv6_skb_idev(skb), IPSTATS_MIB_INTRUNCATEDPKTS); | 609 | IP6_INC_STATS_BH(net, ipv6_skb_idev(skb), |
610 | IPSTATS_MIB_INTRUNCATEDPKTS); | ||
605 | goto drop; | 611 | goto drop; |
606 | } | 612 | } |
607 | 613 | ||