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 | |
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')
-rw-r--r-- | net/ipv6/exthdrs.c | 42 | ||||
-rw-r--r-- | net/ipv6/ip6_input.c | 27 | ||||
-rw-r--r-- | net/ipv6/ip6_output.c | 18 | ||||
-rw-r--r-- | net/ipv6/ip6mr.c | 3 | ||||
-rw-r--r-- | net/ipv6/mcast.c | 4 | ||||
-rw-r--r-- | net/ipv6/reassembly.c | 26 |
6 files changed, 70 insertions, 50 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 | ||
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c index 7e14cccd0561..936f48946e20 100644 --- a/net/ipv6/ip6_input.c +++ b/net/ipv6/ip6_input.c | |||
@@ -59,6 +59,7 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt | |||
59 | struct ipv6hdr *hdr; | 59 | struct ipv6hdr *hdr; |
60 | u32 pkt_len; | 60 | u32 pkt_len; |
61 | struct inet6_dev *idev; | 61 | struct inet6_dev *idev; |
62 | struct net *net = dev_net(skb->dev); | ||
62 | 63 | ||
63 | if (skb->pkt_type == PACKET_OTHERHOST) { | 64 | if (skb->pkt_type == PACKET_OTHERHOST) { |
64 | kfree_skb(skb); | 65 | kfree_skb(skb); |
@@ -69,11 +70,11 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt | |||
69 | 70 | ||
70 | idev = __in6_dev_get(skb->dev); | 71 | idev = __in6_dev_get(skb->dev); |
71 | 72 | ||
72 | IP6_INC_STATS_BH(idev, IPSTATS_MIB_INRECEIVES); | 73 | IP6_INC_STATS_BH(net, idev, IPSTATS_MIB_INRECEIVES); |
73 | 74 | ||
74 | if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL || | 75 | if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL || |
75 | !idev || unlikely(idev->cnf.disable_ipv6)) { | 76 | !idev || unlikely(idev->cnf.disable_ipv6)) { |
76 | IP6_INC_STATS_BH(idev, IPSTATS_MIB_INDISCARDS); | 77 | IP6_INC_STATS_BH(net, idev, IPSTATS_MIB_INDISCARDS); |
77 | rcu_read_unlock(); | 78 | rcu_read_unlock(); |
78 | goto out; | 79 | goto out; |
79 | } | 80 | } |
@@ -118,11 +119,12 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt | |||
118 | /* pkt_len may be zero if Jumbo payload option is present */ | 119 | /* pkt_len may be zero if Jumbo payload option is present */ |
119 | if (pkt_len || hdr->nexthdr != NEXTHDR_HOP) { | 120 | if (pkt_len || hdr->nexthdr != NEXTHDR_HOP) { |
120 | if (pkt_len + sizeof(struct ipv6hdr) > skb->len) { | 121 | if (pkt_len + sizeof(struct ipv6hdr) > skb->len) { |
121 | IP6_INC_STATS_BH(idev, IPSTATS_MIB_INTRUNCATEDPKTS); | 122 | IP6_INC_STATS_BH(net, |
123 | idev, IPSTATS_MIB_INTRUNCATEDPKTS); | ||
122 | goto drop; | 124 | goto drop; |
123 | } | 125 | } |
124 | if (pskb_trim_rcsum(skb, pkt_len + sizeof(struct ipv6hdr))) { | 126 | if (pskb_trim_rcsum(skb, pkt_len + sizeof(struct ipv6hdr))) { |
125 | IP6_INC_STATS_BH(idev, IPSTATS_MIB_INHDRERRORS); | 127 | IP6_INC_STATS_BH(net, idev, IPSTATS_MIB_INHDRERRORS); |
126 | goto drop; | 128 | goto drop; |
127 | } | 129 | } |
128 | hdr = ipv6_hdr(skb); | 130 | hdr = ipv6_hdr(skb); |
@@ -130,7 +132,7 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt | |||
130 | 132 | ||
131 | if (hdr->nexthdr == NEXTHDR_HOP) { | 133 | if (hdr->nexthdr == NEXTHDR_HOP) { |
132 | if (ipv6_parse_hopopts(skb) < 0) { | 134 | if (ipv6_parse_hopopts(skb) < 0) { |
133 | IP6_INC_STATS_BH(idev, IPSTATS_MIB_INHDRERRORS); | 135 | IP6_INC_STATS_BH(net, idev, IPSTATS_MIB_INHDRERRORS); |
134 | rcu_read_unlock(); | 136 | rcu_read_unlock(); |
135 | return 0; | 137 | return 0; |
136 | } | 138 | } |
@@ -141,7 +143,7 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt | |||
141 | return NF_HOOK(PF_INET6, NF_INET_PRE_ROUTING, skb, dev, NULL, | 143 | return NF_HOOK(PF_INET6, NF_INET_PRE_ROUTING, skb, dev, NULL, |
142 | ip6_rcv_finish); | 144 | ip6_rcv_finish); |
143 | err: | 145 | err: |
144 | IP6_INC_STATS_BH(idev, IPSTATS_MIB_INHDRERRORS); | 146 | IP6_INC_STATS_BH(net, idev, IPSTATS_MIB_INHDRERRORS); |
145 | drop: | 147 | drop: |
146 | rcu_read_unlock(); | 148 | rcu_read_unlock(); |
147 | kfree_skb(skb); | 149 | kfree_skb(skb); |
@@ -161,6 +163,7 @@ static int ip6_input_finish(struct sk_buff *skb) | |||
161 | int nexthdr, raw; | 163 | int nexthdr, raw; |
162 | u8 hash; | 164 | u8 hash; |
163 | struct inet6_dev *idev; | 165 | struct inet6_dev *idev; |
166 | struct net *net = dev_net(skb->dst->dev); | ||
164 | 167 | ||
165 | /* | 168 | /* |
166 | * Parse extension headers | 169 | * Parse extension headers |
@@ -205,24 +208,25 @@ resubmit: | |||
205 | if (ret > 0) | 208 | if (ret > 0) |
206 | goto resubmit; | 209 | goto resubmit; |
207 | else if (ret == 0) | 210 | else if (ret == 0) |
208 | IP6_INC_STATS_BH(idev, IPSTATS_MIB_INDELIVERS); | 211 | IP6_INC_STATS_BH(net, idev, IPSTATS_MIB_INDELIVERS); |
209 | } else { | 212 | } else { |
210 | if (!raw) { | 213 | if (!raw) { |
211 | if (xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)) { | 214 | if (xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)) { |
212 | IP6_INC_STATS_BH(idev, IPSTATS_MIB_INUNKNOWNPROTOS); | 215 | IP6_INC_STATS_BH(net, idev, |
216 | IPSTATS_MIB_INUNKNOWNPROTOS); | ||
213 | icmpv6_send(skb, ICMPV6_PARAMPROB, | 217 | icmpv6_send(skb, ICMPV6_PARAMPROB, |
214 | ICMPV6_UNK_NEXTHDR, nhoff, | 218 | ICMPV6_UNK_NEXTHDR, nhoff, |
215 | skb->dev); | 219 | skb->dev); |
216 | } | 220 | } |
217 | } else | 221 | } else |
218 | IP6_INC_STATS_BH(idev, IPSTATS_MIB_INDELIVERS); | 222 | IP6_INC_STATS_BH(net, idev, IPSTATS_MIB_INDELIVERS); |
219 | kfree_skb(skb); | 223 | kfree_skb(skb); |
220 | } | 224 | } |
221 | rcu_read_unlock(); | 225 | rcu_read_unlock(); |
222 | return 0; | 226 | return 0; |
223 | 227 | ||
224 | discard: | 228 | discard: |
225 | IP6_INC_STATS_BH(idev, IPSTATS_MIB_INDISCARDS); | 229 | IP6_INC_STATS_BH(net, idev, IPSTATS_MIB_INDISCARDS); |
226 | rcu_read_unlock(); | 230 | rcu_read_unlock(); |
227 | kfree_skb(skb); | 231 | kfree_skb(skb); |
228 | return 0; | 232 | return 0; |
@@ -240,7 +244,8 @@ int ip6_mc_input(struct sk_buff *skb) | |||
240 | struct ipv6hdr *hdr; | 244 | struct ipv6hdr *hdr; |
241 | int deliver; | 245 | int deliver; |
242 | 246 | ||
243 | IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_INMCASTPKTS); | 247 | IP6_INC_STATS_BH(dev_net(skb->dst->dev), |
248 | ip6_dst_idev(skb->dst), IPSTATS_MIB_INMCASTPKTS); | ||
244 | 249 | ||
245 | hdr = ipv6_hdr(skb); | 250 | hdr = ipv6_hdr(skb); |
246 | deliver = ipv6_chk_mcast_addr(skb->dev, &hdr->daddr, NULL); | 251 | deliver = ipv6_chk_mcast_addr(skb->dev, &hdr->daddr, NULL); |
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index db28c208f329..f0fded630f57 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -103,7 +103,8 @@ static int ip6_output_finish(struct sk_buff *skb) | |||
103 | else if (dst->neighbour) | 103 | else if (dst->neighbour) |
104 | return dst->neighbour->output(skb); | 104 | return dst->neighbour->output(skb); |
105 | 105 | ||
106 | IP6_INC_STATS_BH(ip6_dst_idev(dst), IPSTATS_MIB_OUTNOROUTES); | 106 | IP6_INC_STATS_BH(dev_net(dst->dev), |
107 | ip6_dst_idev(dst), IPSTATS_MIB_OUTNOROUTES); | ||
107 | kfree_skb(skb); | 108 | kfree_skb(skb); |
108 | return -EINVAL; | 109 | return -EINVAL; |
109 | 110 | ||
@@ -458,7 +459,8 @@ int ip6_forward(struct sk_buff *skb) | |||
458 | skb->dev = dst->dev; | 459 | skb->dev = dst->dev; |
459 | icmpv6_send(skb, ICMPV6_TIME_EXCEED, ICMPV6_EXC_HOPLIMIT, | 460 | icmpv6_send(skb, ICMPV6_TIME_EXCEED, ICMPV6_EXC_HOPLIMIT, |
460 | 0, skb->dev); | 461 | 0, skb->dev); |
461 | IP6_INC_STATS_BH(ip6_dst_idev(dst), IPSTATS_MIB_INHDRERRORS); | 462 | IP6_INC_STATS_BH(net, |
463 | ip6_dst_idev(dst), IPSTATS_MIB_INHDRERRORS); | ||
462 | 464 | ||
463 | kfree_skb(skb); | 465 | kfree_skb(skb); |
464 | return -ETIMEDOUT; | 466 | return -ETIMEDOUT; |
@@ -527,8 +529,10 @@ int ip6_forward(struct sk_buff *skb) | |||
527 | /* Again, force OUTPUT device used as source address */ | 529 | /* Again, force OUTPUT device used as source address */ |
528 | skb->dev = dst->dev; | 530 | skb->dev = dst->dev; |
529 | icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, dst_mtu(dst), skb->dev); | 531 | icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, dst_mtu(dst), skb->dev); |
530 | IP6_INC_STATS_BH(ip6_dst_idev(dst), IPSTATS_MIB_INTOOBIGERRORS); | 532 | IP6_INC_STATS_BH(net, |
531 | IP6_INC_STATS_BH(ip6_dst_idev(dst), IPSTATS_MIB_FRAGFAILS); | 533 | ip6_dst_idev(dst), IPSTATS_MIB_INTOOBIGERRORS); |
534 | IP6_INC_STATS_BH(net, | ||
535 | ip6_dst_idev(dst), IPSTATS_MIB_FRAGFAILS); | ||
532 | kfree_skb(skb); | 536 | kfree_skb(skb); |
533 | return -EMSGSIZE; | 537 | return -EMSGSIZE; |
534 | } | 538 | } |
@@ -544,12 +548,12 @@ int ip6_forward(struct sk_buff *skb) | |||
544 | 548 | ||
545 | hdr->hop_limit--; | 549 | hdr->hop_limit--; |
546 | 550 | ||
547 | IP6_INC_STATS_BH(ip6_dst_idev(dst), IPSTATS_MIB_OUTFORWDATAGRAMS); | 551 | IP6_INC_STATS_BH(net, ip6_dst_idev(dst), IPSTATS_MIB_OUTFORWDATAGRAMS); |
548 | return NF_HOOK(PF_INET6, NF_INET_FORWARD, skb, skb->dev, dst->dev, | 552 | return NF_HOOK(PF_INET6, NF_INET_FORWARD, skb, skb->dev, dst->dev, |
549 | ip6_forward_finish); | 553 | ip6_forward_finish); |
550 | 554 | ||
551 | error: | 555 | error: |
552 | IP6_INC_STATS_BH(ip6_dst_idev(dst), IPSTATS_MIB_INADDRERRORS); | 556 | IP6_INC_STATS_BH(net, ip6_dst_idev(dst), IPSTATS_MIB_INADDRERRORS); |
553 | drop: | 557 | drop: |
554 | kfree_skb(skb); | 558 | kfree_skb(skb); |
555 | return -EINVAL; | 559 | return -EINVAL; |
@@ -991,7 +995,7 @@ static int ip6_dst_lookup_tail(struct sock *sk, | |||
991 | 995 | ||
992 | out_err_release: | 996 | out_err_release: |
993 | if (err == -ENETUNREACH) | 997 | if (err == -ENETUNREACH) |
994 | IP6_INC_STATS_BH(NULL, IPSTATS_MIB_OUTNOROUTES); | 998 | IP6_INC_STATS_BH(net, NULL, IPSTATS_MIB_OUTNOROUTES); |
995 | dst_release(*dst); | 999 | dst_release(*dst); |
996 | *dst = NULL; | 1000 | *dst = NULL; |
997 | return err; | 1001 | return err; |
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index 095bc453ff4c..182f8a177e7f 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c | |||
@@ -1383,7 +1383,8 @@ int ip6mr_ioctl(struct sock *sk, int cmd, void __user *arg) | |||
1383 | 1383 | ||
1384 | static inline int ip6mr_forward2_finish(struct sk_buff *skb) | 1384 | static inline int ip6mr_forward2_finish(struct sk_buff *skb) |
1385 | { | 1385 | { |
1386 | IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_OUTFORWDATAGRAMS); | 1386 | IP6_INC_STATS_BH(dev_net(skb->dst->dev), ip6_dst_idev(skb->dst), |
1387 | IPSTATS_MIB_OUTFORWDATAGRAMS); | ||
1387 | return dst_output(skb); | 1388 | return dst_output(skb); |
1388 | } | 1389 | } |
1389 | 1390 | ||
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index a1d588d0b5d4..88811ebbe4be 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c | |||
@@ -1476,9 +1476,9 @@ out: | |||
1476 | if (!err) { | 1476 | if (!err) { |
1477 | ICMP6MSGOUT_INC_STATS_BH(idev, ICMPV6_MLD2_REPORT); | 1477 | ICMP6MSGOUT_INC_STATS_BH(idev, ICMPV6_MLD2_REPORT); |
1478 | ICMP6_INC_STATS_BH(idev, ICMP6_MIB_OUTMSGS); | 1478 | ICMP6_INC_STATS_BH(idev, ICMP6_MIB_OUTMSGS); |
1479 | IP6_INC_STATS_BH(idev, IPSTATS_MIB_OUTMCASTPKTS); | 1479 | IP6_INC_STATS_BH(net, idev, IPSTATS_MIB_OUTMCASTPKTS); |
1480 | } else | 1480 | } else |
1481 | IP6_INC_STATS_BH(idev, IPSTATS_MIB_OUTDISCARDS); | 1481 | IP6_INC_STATS_BH(net, idev, IPSTATS_MIB_OUTDISCARDS); |
1482 | 1482 | ||
1483 | if (likely(idev != NULL)) | 1483 | if (likely(idev != NULL)) |
1484 | in6_dev_put(idev); | 1484 | in6_dev_put(idev); |
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c index 63644075f2d6..693d20836b3f 100644 --- a/net/ipv6/reassembly.c +++ b/net/ipv6/reassembly.c | |||
@@ -213,8 +213,8 @@ static void ip6_frag_expire(unsigned long data) | |||
213 | goto out; | 213 | goto out; |
214 | 214 | ||
215 | rcu_read_lock(); | 215 | rcu_read_lock(); |
216 | IP6_INC_STATS_BH(__in6_dev_get(dev), IPSTATS_MIB_REASMTIMEOUT); | 216 | IP6_INC_STATS_BH(net, __in6_dev_get(dev), IPSTATS_MIB_REASMTIMEOUT); |
217 | IP6_INC_STATS_BH(__in6_dev_get(dev), IPSTATS_MIB_REASMFAILS); | 217 | IP6_INC_STATS_BH(net, __in6_dev_get(dev), IPSTATS_MIB_REASMFAILS); |
218 | rcu_read_unlock(); | 218 | rcu_read_unlock(); |
219 | 219 | ||
220 | /* Don't send error if the first segment did not arrive. */ | 220 | /* Don't send error if the first segment did not arrive. */ |
@@ -257,7 +257,7 @@ fq_find(struct net *net, __be32 id, struct in6_addr *src, struct in6_addr *dst, | |||
257 | return container_of(q, struct frag_queue, q); | 257 | return container_of(q, struct frag_queue, q); |
258 | 258 | ||
259 | oom: | 259 | oom: |
260 | IP6_INC_STATS_BH(idev, IPSTATS_MIB_REASMFAILS); | 260 | IP6_INC_STATS_BH(net, idev, IPSTATS_MIB_REASMFAILS); |
261 | return NULL; | 261 | return NULL; |
262 | } | 262 | } |
263 | 263 | ||
@@ -267,6 +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 | 271 | ||
271 | if (fq->q.last_in & INET_FRAG_COMPLETE) | 272 | if (fq->q.last_in & INET_FRAG_COMPLETE) |
272 | goto err; | 273 | goto err; |
@@ -276,7 +277,7 @@ static int ip6_frag_queue(struct frag_queue *fq, struct sk_buff *skb, | |||
276 | ((u8 *)(fhdr + 1) - (u8 *)(ipv6_hdr(skb) + 1))); | 277 | ((u8 *)(fhdr + 1) - (u8 *)(ipv6_hdr(skb) + 1))); |
277 | 278 | ||
278 | if ((unsigned int)end > IPV6_MAXPLEN) { | 279 | if ((unsigned int)end > IPV6_MAXPLEN) { |
279 | IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), | 280 | IP6_INC_STATS_BH(net, ip6_dst_idev(skb->dst), |
280 | IPSTATS_MIB_INHDRERRORS); | 281 | IPSTATS_MIB_INHDRERRORS); |
281 | icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, | 282 | icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, |
282 | ((u8 *)&fhdr->frag_off - | 283 | ((u8 *)&fhdr->frag_off - |
@@ -309,7 +310,7 @@ static int ip6_frag_queue(struct frag_queue *fq, struct sk_buff *skb, | |||
309 | /* RFC2460 says always send parameter problem in | 310 | /* RFC2460 says always send parameter problem in |
310 | * this case. -DaveM | 311 | * this case. -DaveM |
311 | */ | 312 | */ |
312 | IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), | 313 | IP6_INC_STATS_BH(net, ip6_dst_idev(skb->dst), |
313 | IPSTATS_MIB_INHDRERRORS); | 314 | IPSTATS_MIB_INHDRERRORS); |
314 | icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, | 315 | icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, |
315 | offsetof(struct ipv6hdr, payload_len)); | 316 | offsetof(struct ipv6hdr, payload_len)); |
@@ -433,7 +434,7 @@ static int ip6_frag_queue(struct frag_queue *fq, struct sk_buff *skb, | |||
433 | return -1; | 434 | return -1; |
434 | 435 | ||
435 | err: | 436 | err: |
436 | IP6_INC_STATS(dev_net(skb->dst->dev), ip6_dst_idev(skb->dst), | 437 | IP6_INC_STATS(net, ip6_dst_idev(skb->dst), |
437 | IPSTATS_MIB_REASMFAILS); | 438 | IPSTATS_MIB_REASMFAILS); |
438 | kfree_skb(skb); | 439 | kfree_skb(skb); |
439 | return -1; | 440 | return -1; |
@@ -550,7 +551,8 @@ static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff *prev, | |||
550 | head->csum); | 551 | head->csum); |
551 | 552 | ||
552 | rcu_read_lock(); | 553 | rcu_read_lock(); |
553 | IP6_INC_STATS_BH(__in6_dev_get(dev), IPSTATS_MIB_REASMOKS); | 554 | IP6_INC_STATS_BH(dev_net(dev), |
555 | __in6_dev_get(dev), IPSTATS_MIB_REASMOKS); | ||
554 | rcu_read_unlock(); | 556 | rcu_read_unlock(); |
555 | fq->q.fragments = NULL; | 557 | fq->q.fragments = NULL; |
556 | return 1; | 558 | return 1; |
@@ -564,7 +566,8 @@ out_oom: | |||
564 | printk(KERN_DEBUG "ip6_frag_reasm: no memory for reassembly\n"); | 566 | printk(KERN_DEBUG "ip6_frag_reasm: no memory for reassembly\n"); |
565 | out_fail: | 567 | out_fail: |
566 | rcu_read_lock(); | 568 | rcu_read_lock(); |
567 | IP6_INC_STATS_BH(__in6_dev_get(dev), IPSTATS_MIB_REASMFAILS); | 569 | IP6_INC_STATS_BH(dev_net(dev), |
570 | __in6_dev_get(dev), IPSTATS_MIB_REASMFAILS); | ||
568 | rcu_read_unlock(); | 571 | rcu_read_unlock(); |
569 | return -1; | 572 | return -1; |
570 | } | 573 | } |
@@ -576,7 +579,7 @@ static int ipv6_frag_rcv(struct sk_buff *skb) | |||
576 | struct ipv6hdr *hdr = ipv6_hdr(skb); | 579 | struct ipv6hdr *hdr = ipv6_hdr(skb); |
577 | struct net *net = dev_net(skb->dst->dev); | 580 | struct net *net = dev_net(skb->dst->dev); |
578 | 581 | ||
579 | IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_REASMREQDS); | 582 | IP6_INC_STATS_BH(net, ip6_dst_idev(skb->dst), IPSTATS_MIB_REASMREQDS); |
580 | 583 | ||
581 | /* Jumbo payload inhibits frag. header */ | 584 | /* Jumbo payload inhibits frag. header */ |
582 | if (hdr->payload_len==0) | 585 | if (hdr->payload_len==0) |
@@ -592,7 +595,8 @@ static int ipv6_frag_rcv(struct sk_buff *skb) | |||
592 | if (!(fhdr->frag_off & htons(0xFFF9))) { | 595 | if (!(fhdr->frag_off & htons(0xFFF9))) { |
593 | /* It is not a fragmented frame */ | 596 | /* It is not a fragmented frame */ |
594 | skb->transport_header += sizeof(struct frag_hdr); | 597 | skb->transport_header += sizeof(struct frag_hdr); |
595 | IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_REASMOKS); | 598 | IP6_INC_STATS_BH(net, |
599 | ip6_dst_idev(skb->dst), IPSTATS_MIB_REASMOKS); | ||
596 | 600 | ||
597 | IP6CB(skb)->nhoff = (u8 *)fhdr - skb_network_header(skb); | 601 | IP6CB(skb)->nhoff = (u8 *)fhdr - skb_network_header(skb); |
598 | return 1; | 602 | return 1; |
@@ -614,7 +618,7 @@ static int ipv6_frag_rcv(struct sk_buff *skb) | |||
614 | return ret; | 618 | return ret; |
615 | } | 619 | } |
616 | 620 | ||
617 | IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_REASMFAILS); | 621 | IP6_INC_STATS_BH(net, ip6_dst_idev(skb->dst), IPSTATS_MIB_REASMFAILS); |
618 | kfree_skb(skb); | 622 | kfree_skb(skb); |
619 | return -1; | 623 | return -1; |
620 | 624 | ||