diff options
author | Denis V. Lunev <den@openvz.org> | 2008-10-08 13:54:51 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-10-08 13:54:51 -0400 |
commit | 3bd653c8455bc7991bae77968702b31c8f5df883 (patch) | |
tree | f21c557e4b002ddf265ed111edd2c0bb97b01e38 | |
parent | 98b3377ca77a06a7bd75a444e9f7136e9bb5112e (diff) |
netns: add net parameter to IP6_INC_STATS
Signed-off-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/ipv6.h | 3 | ||||
-rw-r--r-- | net/ipv6/icmp.c | 2 | ||||
-rw-r--r-- | net/ipv6/ip6_output.c | 56 | ||||
-rw-r--r-- | net/ipv6/mcast.c | 10 | ||||
-rw-r--r-- | net/ipv6/ndisc.c | 4 | ||||
-rw-r--r-- | net/ipv6/netfilter.c | 3 | ||||
-rw-r--r-- | net/ipv6/raw.c | 4 | ||||
-rw-r--r-- | net/ipv6/reassembly.c | 8 | ||||
-rw-r--r-- | net/ipv6/route.c | 7 |
9 files changed, 57 insertions, 40 deletions
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index dfa7ae3c5607..26c17988b905 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
@@ -129,7 +129,8 @@ extern struct ctl_path net_ipv6_ctl_path[]; | |||
129 | /* MIBs */ | 129 | /* MIBs */ |
130 | DECLARE_SNMP_STAT(struct ipstats_mib, ipv6_statistics); | 130 | DECLARE_SNMP_STAT(struct ipstats_mib, ipv6_statistics); |
131 | 131 | ||
132 | #define IP6_INC_STATS(idev,field) _DEVINC(ipv6, , idev, field) | 132 | #define IP6_INC_STATS(net, idev,field) ({ (void)(net); \ |
133 | _DEVINC(ipv6, , idev, field); }) | ||
133 | #define IP6_INC_STATS_BH(idev,field) _DEVINC(ipv6, _BH, idev, field) | 134 | #define IP6_INC_STATS_BH(idev,field) _DEVINC(ipv6, _BH, idev, field) |
134 | #define IP6_ADD_STATS_BH(idev,field,val) _DEVADD(ipv6, _BH, idev, field, val) | 135 | #define IP6_ADD_STATS_BH(idev,field,val) _DEVADD(ipv6, _BH, idev, field, val) |
135 | 136 | ||
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c index b3157a0cc15d..758cdd7dc27e 100644 --- a/net/ipv6/icmp.c +++ b/net/ipv6/icmp.c | |||
@@ -183,7 +183,7 @@ static inline int icmpv6_xrlim_allow(struct sock *sk, int type, | |||
183 | */ | 183 | */ |
184 | dst = ip6_route_output(net, sk, fl); | 184 | dst = ip6_route_output(net, sk, fl); |
185 | if (dst->error) { | 185 | if (dst->error) { |
186 | IP6_INC_STATS(ip6_dst_idev(dst), | 186 | IP6_INC_STATS(net, ip6_dst_idev(dst), |
187 | IPSTATS_MIB_OUTNOROUTES); | 187 | IPSTATS_MIB_OUTNOROUTES); |
188 | } else if (dst->dev && (dst->dev->flags&IFF_LOOPBACK)) { | 188 | } else if (dst->dev && (dst->dev->flags&IFF_LOOPBACK)) { |
189 | res = 1; | 189 | res = 1; |
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index f22393e11666..db28c208f329 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -150,13 +150,14 @@ static int ip6_output2(struct sk_buff *skb) | |||
150 | ip6_dev_loopback_xmit); | 150 | ip6_dev_loopback_xmit); |
151 | 151 | ||
152 | if (ipv6_hdr(skb)->hop_limit == 0) { | 152 | if (ipv6_hdr(skb)->hop_limit == 0) { |
153 | IP6_INC_STATS(idev, IPSTATS_MIB_OUTDISCARDS); | 153 | IP6_INC_STATS(dev_net(dev), idev, |
154 | IPSTATS_MIB_OUTDISCARDS); | ||
154 | kfree_skb(skb); | 155 | kfree_skb(skb); |
155 | return 0; | 156 | return 0; |
156 | } | 157 | } |
157 | } | 158 | } |
158 | 159 | ||
159 | IP6_INC_STATS(idev, IPSTATS_MIB_OUTMCASTPKTS); | 160 | IP6_INC_STATS(dev_net(dev), idev, IPSTATS_MIB_OUTMCASTPKTS); |
160 | } | 161 | } |
161 | 162 | ||
162 | return NF_HOOK(PF_INET6, NF_INET_POST_ROUTING, skb, NULL, skb->dev, | 163 | return NF_HOOK(PF_INET6, NF_INET_POST_ROUTING, skb, NULL, skb->dev, |
@@ -175,7 +176,8 @@ int ip6_output(struct sk_buff *skb) | |||
175 | { | 176 | { |
176 | struct inet6_dev *idev = ip6_dst_idev(skb->dst); | 177 | struct inet6_dev *idev = ip6_dst_idev(skb->dst); |
177 | if (unlikely(idev->cnf.disable_ipv6)) { | 178 | if (unlikely(idev->cnf.disable_ipv6)) { |
178 | IP6_INC_STATS(idev, IPSTATS_MIB_OUTDISCARDS); | 179 | IP6_INC_STATS(dev_net(skb->dst->dev), idev, |
180 | IPSTATS_MIB_OUTDISCARDS); | ||
179 | kfree_skb(skb); | 181 | kfree_skb(skb); |
180 | return 0; | 182 | return 0; |
181 | } | 183 | } |
@@ -194,6 +196,7 @@ int ip6_output(struct sk_buff *skb) | |||
194 | int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl, | 196 | int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl, |
195 | struct ipv6_txoptions *opt, int ipfragok) | 197 | struct ipv6_txoptions *opt, int ipfragok) |
196 | { | 198 | { |
199 | struct net *net = sock_net(sk); | ||
197 | struct ipv6_pinfo *np = inet6_sk(sk); | 200 | struct ipv6_pinfo *np = inet6_sk(sk); |
198 | struct in6_addr *first_hop = &fl->fl6_dst; | 201 | struct in6_addr *first_hop = &fl->fl6_dst; |
199 | struct dst_entry *dst = skb->dst; | 202 | struct dst_entry *dst = skb->dst; |
@@ -216,7 +219,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl, | |||
216 | if (skb_headroom(skb) < head_room) { | 219 | if (skb_headroom(skb) < head_room) { |
217 | struct sk_buff *skb2 = skb_realloc_headroom(skb, head_room); | 220 | struct sk_buff *skb2 = skb_realloc_headroom(skb, head_room); |
218 | if (skb2 == NULL) { | 221 | if (skb2 == NULL) { |
219 | IP6_INC_STATS(ip6_dst_idev(skb->dst), | 222 | IP6_INC_STATS(net, ip6_dst_idev(skb->dst), |
220 | IPSTATS_MIB_OUTDISCARDS); | 223 | IPSTATS_MIB_OUTDISCARDS); |
221 | kfree_skb(skb); | 224 | kfree_skb(skb); |
222 | return -ENOBUFS; | 225 | return -ENOBUFS; |
@@ -270,7 +273,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl, | |||
270 | 273 | ||
271 | mtu = dst_mtu(dst); | 274 | mtu = dst_mtu(dst); |
272 | if ((skb->len <= mtu) || skb->local_df || skb_is_gso(skb)) { | 275 | if ((skb->len <= mtu) || skb->local_df || skb_is_gso(skb)) { |
273 | IP6_INC_STATS(ip6_dst_idev(skb->dst), | 276 | IP6_INC_STATS(net, ip6_dst_idev(skb->dst), |
274 | IPSTATS_MIB_OUTREQUESTS); | 277 | IPSTATS_MIB_OUTREQUESTS); |
275 | return NF_HOOK(PF_INET6, NF_INET_LOCAL_OUT, skb, NULL, dst->dev, | 278 | return NF_HOOK(PF_INET6, NF_INET_LOCAL_OUT, skb, NULL, dst->dev, |
276 | dst_output); | 279 | dst_output); |
@@ -280,7 +283,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl, | |||
280 | printk(KERN_DEBUG "IPv6: sending pkt_too_big to self\n"); | 283 | printk(KERN_DEBUG "IPv6: sending pkt_too_big to self\n"); |
281 | skb->dev = dst->dev; | 284 | skb->dev = dst->dev; |
282 | icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, skb->dev); | 285 | icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, skb->dev); |
283 | IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_FRAGFAILS); | 286 | IP6_INC_STATS(net, ip6_dst_idev(skb->dst), IPSTATS_MIB_FRAGFAILS); |
284 | kfree_skb(skb); | 287 | kfree_skb(skb); |
285 | return -EMSGSIZE; | 288 | return -EMSGSIZE; |
286 | } | 289 | } |
@@ -422,7 +425,7 @@ int ip6_forward(struct sk_buff *skb) | |||
422 | goto drop; | 425 | goto drop; |
423 | 426 | ||
424 | if (!xfrm6_policy_check(NULL, XFRM_POLICY_FWD, skb)) { | 427 | if (!xfrm6_policy_check(NULL, XFRM_POLICY_FWD, skb)) { |
425 | IP6_INC_STATS(ip6_dst_idev(dst), IPSTATS_MIB_INDISCARDS); | 428 | IP6_INC_STATS(net, ip6_dst_idev(dst), IPSTATS_MIB_INDISCARDS); |
426 | goto drop; | 429 | goto drop; |
427 | } | 430 | } |
428 | 431 | ||
@@ -468,13 +471,14 @@ int ip6_forward(struct sk_buff *skb) | |||
468 | if (proxied > 0) | 471 | if (proxied > 0) |
469 | return ip6_input(skb); | 472 | return ip6_input(skb); |
470 | else if (proxied < 0) { | 473 | else if (proxied < 0) { |
471 | IP6_INC_STATS(ip6_dst_idev(dst), IPSTATS_MIB_INDISCARDS); | 474 | IP6_INC_STATS(net, ip6_dst_idev(dst), |
475 | IPSTATS_MIB_INDISCARDS); | ||
472 | goto drop; | 476 | goto drop; |
473 | } | 477 | } |
474 | } | 478 | } |
475 | 479 | ||
476 | if (!xfrm6_route_forward(skb)) { | 480 | if (!xfrm6_route_forward(skb)) { |
477 | IP6_INC_STATS(ip6_dst_idev(dst), IPSTATS_MIB_INDISCARDS); | 481 | IP6_INC_STATS(net, ip6_dst_idev(dst), IPSTATS_MIB_INDISCARDS); |
478 | goto drop; | 482 | goto drop; |
479 | } | 483 | } |
480 | dst = skb->dst; | 484 | dst = skb->dst; |
@@ -530,7 +534,7 @@ int ip6_forward(struct sk_buff *skb) | |||
530 | } | 534 | } |
531 | 535 | ||
532 | if (skb_cow(skb, dst->dev->hard_header_len)) { | 536 | if (skb_cow(skb, dst->dev->hard_header_len)) { |
533 | IP6_INC_STATS(ip6_dst_idev(dst), IPSTATS_MIB_OUTDISCARDS); | 537 | IP6_INC_STATS(net, ip6_dst_idev(dst), IPSTATS_MIB_OUTDISCARDS); |
534 | goto drop; | 538 | goto drop; |
535 | } | 539 | } |
536 | 540 | ||
@@ -622,6 +626,7 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)) | |||
622 | __be32 frag_id = 0; | 626 | __be32 frag_id = 0; |
623 | int ptr, offset = 0, err=0; | 627 | int ptr, offset = 0, err=0; |
624 | u8 *prevhdr, nexthdr = 0; | 628 | u8 *prevhdr, nexthdr = 0; |
629 | struct net *net = dev_net(skb->dst->dev); | ||
625 | 630 | ||
626 | hlen = ip6_find_1stfragopt(skb, &prevhdr); | 631 | hlen = ip6_find_1stfragopt(skb, &prevhdr); |
627 | nexthdr = *prevhdr; | 632 | nexthdr = *prevhdr; |
@@ -635,7 +640,8 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)) | |||
635 | if (!skb->local_df) { | 640 | if (!skb->local_df) { |
636 | skb->dev = skb->dst->dev; | 641 | skb->dev = skb->dst->dev; |
637 | icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, skb->dev); | 642 | icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, skb->dev); |
638 | IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_FRAGFAILS); | 643 | IP6_INC_STATS(net, ip6_dst_idev(skb->dst), |
644 | IPSTATS_MIB_FRAGFAILS); | ||
639 | kfree_skb(skb); | 645 | kfree_skb(skb); |
640 | return -EMSGSIZE; | 646 | return -EMSGSIZE; |
641 | } | 647 | } |
@@ -684,7 +690,8 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)) | |||
684 | *prevhdr = NEXTHDR_FRAGMENT; | 690 | *prevhdr = NEXTHDR_FRAGMENT; |
685 | tmp_hdr = kmemdup(skb_network_header(skb), hlen, GFP_ATOMIC); | 691 | tmp_hdr = kmemdup(skb_network_header(skb), hlen, GFP_ATOMIC); |
686 | if (!tmp_hdr) { | 692 | if (!tmp_hdr) { |
687 | IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_FRAGFAILS); | 693 | IP6_INC_STATS(net, ip6_dst_idev(skb->dst), |
694 | IPSTATS_MIB_FRAGFAILS); | ||
688 | return -ENOMEM; | 695 | return -ENOMEM; |
689 | } | 696 | } |
690 | 697 | ||
@@ -735,7 +742,8 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)) | |||
735 | 742 | ||
736 | err = output(skb); | 743 | err = output(skb); |
737 | if(!err) | 744 | if(!err) |
738 | IP6_INC_STATS(ip6_dst_idev(&rt->u.dst), IPSTATS_MIB_FRAGCREATES); | 745 | IP6_INC_STATS(net, ip6_dst_idev(&rt->u.dst), |
746 | IPSTATS_MIB_FRAGCREATES); | ||
739 | 747 | ||
740 | if (err || !frag) | 748 | if (err || !frag) |
741 | break; | 749 | break; |
@@ -748,7 +756,8 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)) | |||
748 | kfree(tmp_hdr); | 756 | kfree(tmp_hdr); |
749 | 757 | ||
750 | if (err == 0) { | 758 | if (err == 0) { |
751 | IP6_INC_STATS(ip6_dst_idev(&rt->u.dst), IPSTATS_MIB_FRAGOKS); | 759 | IP6_INC_STATS(net, ip6_dst_idev(&rt->u.dst), |
760 | IPSTATS_MIB_FRAGOKS); | ||
752 | dst_release(&rt->u.dst); | 761 | dst_release(&rt->u.dst); |
753 | return 0; | 762 | return 0; |
754 | } | 763 | } |
@@ -759,7 +768,8 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)) | |||
759 | frag = skb; | 768 | frag = skb; |
760 | } | 769 | } |
761 | 770 | ||
762 | IP6_INC_STATS(ip6_dst_idev(&rt->u.dst), IPSTATS_MIB_FRAGFAILS); | 771 | IP6_INC_STATS(net, ip6_dst_idev(&rt->u.dst), |
772 | IPSTATS_MIB_FRAGFAILS); | ||
763 | dst_release(&rt->u.dst); | 773 | dst_release(&rt->u.dst); |
764 | return err; | 774 | return err; |
765 | } | 775 | } |
@@ -793,7 +803,7 @@ slow_path: | |||
793 | 803 | ||
794 | if ((frag = alloc_skb(len+hlen+sizeof(struct frag_hdr)+LL_ALLOCATED_SPACE(rt->u.dst.dev), GFP_ATOMIC)) == NULL) { | 804 | if ((frag = alloc_skb(len+hlen+sizeof(struct frag_hdr)+LL_ALLOCATED_SPACE(rt->u.dst.dev), GFP_ATOMIC)) == NULL) { |
795 | NETDEBUG(KERN_INFO "IPv6: frag: no memory for new fragment!\n"); | 805 | NETDEBUG(KERN_INFO "IPv6: frag: no memory for new fragment!\n"); |
796 | IP6_INC_STATS(ip6_dst_idev(skb->dst), | 806 | IP6_INC_STATS(net, ip6_dst_idev(skb->dst), |
797 | IPSTATS_MIB_FRAGFAILS); | 807 | IPSTATS_MIB_FRAGFAILS); |
798 | err = -ENOMEM; | 808 | err = -ENOMEM; |
799 | goto fail; | 809 | goto fail; |
@@ -857,15 +867,16 @@ slow_path: | |||
857 | if (err) | 867 | if (err) |
858 | goto fail; | 868 | goto fail; |
859 | 869 | ||
860 | IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_FRAGCREATES); | 870 | IP6_INC_STATS(net, ip6_dst_idev(skb->dst), |
871 | IPSTATS_MIB_FRAGCREATES); | ||
861 | } | 872 | } |
862 | IP6_INC_STATS(ip6_dst_idev(skb->dst), | 873 | IP6_INC_STATS(net, ip6_dst_idev(skb->dst), |
863 | IPSTATS_MIB_FRAGOKS); | 874 | IPSTATS_MIB_FRAGOKS); |
864 | kfree_skb(skb); | 875 | kfree_skb(skb); |
865 | return err; | 876 | return err; |
866 | 877 | ||
867 | fail: | 878 | fail: |
868 | IP6_INC_STATS(ip6_dst_idev(skb->dst), | 879 | IP6_INC_STATS(net, ip6_dst_idev(skb->dst), |
869 | IPSTATS_MIB_FRAGFAILS); | 880 | IPSTATS_MIB_FRAGFAILS); |
870 | kfree_skb(skb); | 881 | kfree_skb(skb); |
871 | return err; | 882 | return err; |
@@ -1385,7 +1396,7 @@ alloc_new_skb: | |||
1385 | return 0; | 1396 | return 0; |
1386 | error: | 1397 | error: |
1387 | inet->cork.length -= length; | 1398 | inet->cork.length -= length; |
1388 | IP6_INC_STATS(rt->rt6i_idev, IPSTATS_MIB_OUTDISCARDS); | 1399 | IP6_INC_STATS(sock_net(sk), rt->rt6i_idev, IPSTATS_MIB_OUTDISCARDS); |
1389 | return err; | 1400 | return err; |
1390 | } | 1401 | } |
1391 | 1402 | ||
@@ -1409,6 +1420,7 @@ int ip6_push_pending_frames(struct sock *sk) | |||
1409 | struct in6_addr final_dst_buf, *final_dst = &final_dst_buf; | 1420 | struct in6_addr final_dst_buf, *final_dst = &final_dst_buf; |
1410 | struct inet_sock *inet = inet_sk(sk); | 1421 | struct inet_sock *inet = inet_sk(sk); |
1411 | struct ipv6_pinfo *np = inet6_sk(sk); | 1422 | struct ipv6_pinfo *np = inet6_sk(sk); |
1423 | struct net *net = sock_net(sk); | ||
1412 | struct ipv6hdr *hdr; | 1424 | struct ipv6hdr *hdr; |
1413 | struct ipv6_txoptions *opt = np->cork.opt; | 1425 | struct ipv6_txoptions *opt = np->cork.opt; |
1414 | struct rt6_info *rt = (struct rt6_info *)inet->cork.dst; | 1426 | struct rt6_info *rt = (struct rt6_info *)inet->cork.dst; |
@@ -1462,7 +1474,7 @@ int ip6_push_pending_frames(struct sock *sk) | |||
1462 | skb->mark = sk->sk_mark; | 1474 | skb->mark = sk->sk_mark; |
1463 | 1475 | ||
1464 | skb->dst = dst_clone(&rt->u.dst); | 1476 | skb->dst = dst_clone(&rt->u.dst); |
1465 | IP6_INC_STATS(rt->rt6i_idev, IPSTATS_MIB_OUTREQUESTS); | 1477 | IP6_INC_STATS(net, rt->rt6i_idev, IPSTATS_MIB_OUTREQUESTS); |
1466 | if (proto == IPPROTO_ICMPV6) { | 1478 | if (proto == IPPROTO_ICMPV6) { |
1467 | struct inet6_dev *idev = ip6_dst_idev(skb->dst); | 1479 | struct inet6_dev *idev = ip6_dst_idev(skb->dst); |
1468 | 1480 | ||
@@ -1491,7 +1503,7 @@ void ip6_flush_pending_frames(struct sock *sk) | |||
1491 | 1503 | ||
1492 | while ((skb = __skb_dequeue_tail(&sk->sk_write_queue)) != NULL) { | 1504 | while ((skb = __skb_dequeue_tail(&sk->sk_write_queue)) != NULL) { |
1493 | if (skb->dst) | 1505 | if (skb->dst) |
1494 | IP6_INC_STATS(ip6_dst_idev(skb->dst), | 1506 | IP6_INC_STATS(sock_net(sk), ip6_dst_idev(skb->dst), |
1495 | IPSTATS_MIB_OUTDISCARDS); | 1507 | IPSTATS_MIB_OUTDISCARDS); |
1496 | kfree_skb(skb); | 1508 | kfree_skb(skb); |
1497 | } | 1509 | } |
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index e7c03bcc2788..a1d588d0b5d4 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c | |||
@@ -1446,7 +1446,7 @@ static void mld_sendpack(struct sk_buff *skb) | |||
1446 | int err; | 1446 | int err; |
1447 | struct flowi fl; | 1447 | struct flowi fl; |
1448 | 1448 | ||
1449 | IP6_INC_STATS(idev, IPSTATS_MIB_OUTREQUESTS); | 1449 | IP6_INC_STATS(net, idev, IPSTATS_MIB_OUTREQUESTS); |
1450 | payload_len = (skb->tail - skb->network_header) - sizeof(*pip6); | 1450 | payload_len = (skb->tail - skb->network_header) - sizeof(*pip6); |
1451 | mldlen = skb->tail - skb->transport_header; | 1451 | mldlen = skb->tail - skb->transport_header; |
1452 | pip6->payload_len = htons(payload_len); | 1452 | pip6->payload_len = htons(payload_len); |
@@ -1771,7 +1771,7 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type) | |||
1771 | struct flowi fl; | 1771 | struct flowi fl; |
1772 | 1772 | ||
1773 | rcu_read_lock(); | 1773 | rcu_read_lock(); |
1774 | IP6_INC_STATS(__in6_dev_get(dev), | 1774 | IP6_INC_STATS(net, __in6_dev_get(dev), |
1775 | IPSTATS_MIB_OUTREQUESTS); | 1775 | IPSTATS_MIB_OUTREQUESTS); |
1776 | rcu_read_unlock(); | 1776 | rcu_read_unlock(); |
1777 | if (type == ICMPV6_MGM_REDUCTION) | 1777 | if (type == ICMPV6_MGM_REDUCTION) |
@@ -1787,7 +1787,7 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type) | |||
1787 | 1787 | ||
1788 | if (skb == NULL) { | 1788 | if (skb == NULL) { |
1789 | rcu_read_lock(); | 1789 | rcu_read_lock(); |
1790 | IP6_INC_STATS(__in6_dev_get(dev), | 1790 | IP6_INC_STATS(net, __in6_dev_get(dev), |
1791 | IPSTATS_MIB_OUTDISCARDS); | 1791 | IPSTATS_MIB_OUTDISCARDS); |
1792 | rcu_read_unlock(); | 1792 | rcu_read_unlock(); |
1793 | return; | 1793 | return; |
@@ -1841,9 +1841,9 @@ out: | |||
1841 | if (!err) { | 1841 | if (!err) { |
1842 | ICMP6MSGOUT_INC_STATS(idev, type); | 1842 | ICMP6MSGOUT_INC_STATS(idev, type); |
1843 | ICMP6_INC_STATS(idev, ICMP6_MIB_OUTMSGS); | 1843 | ICMP6_INC_STATS(idev, ICMP6_MIB_OUTMSGS); |
1844 | IP6_INC_STATS(idev, IPSTATS_MIB_OUTMCASTPKTS); | 1844 | IP6_INC_STATS(net, idev, IPSTATS_MIB_OUTMCASTPKTS); |
1845 | } else | 1845 | } else |
1846 | IP6_INC_STATS(idev, IPSTATS_MIB_OUTDISCARDS); | 1846 | IP6_INC_STATS(net, idev, IPSTATS_MIB_OUTDISCARDS); |
1847 | 1847 | ||
1848 | if (likely(idev != NULL)) | 1848 | if (likely(idev != NULL)) |
1849 | in6_dev_put(idev); | 1849 | in6_dev_put(idev); |
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index f1c62ba0f56b..ce5b61763fd0 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
@@ -516,7 +516,7 @@ static void __ndisc_send(struct net_device *dev, | |||
516 | skb->dst = dst; | 516 | skb->dst = dst; |
517 | 517 | ||
518 | idev = in6_dev_get(dst->dev); | 518 | idev = in6_dev_get(dst->dev); |
519 | IP6_INC_STATS(idev, IPSTATS_MIB_OUTREQUESTS); | 519 | IP6_INC_STATS(net, idev, IPSTATS_MIB_OUTREQUESTS); |
520 | 520 | ||
521 | err = NF_HOOK(PF_INET6, NF_INET_LOCAL_OUT, skb, NULL, dst->dev, | 521 | err = NF_HOOK(PF_INET6, NF_INET_LOCAL_OUT, skb, NULL, dst->dev, |
522 | dst_output); | 522 | dst_output); |
@@ -1581,7 +1581,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh, | |||
1581 | 1581 | ||
1582 | buff->dst = dst; | 1582 | buff->dst = dst; |
1583 | idev = in6_dev_get(dst->dev); | 1583 | idev = in6_dev_get(dst->dev); |
1584 | IP6_INC_STATS(idev, IPSTATS_MIB_OUTREQUESTS); | 1584 | IP6_INC_STATS(net, idev, IPSTATS_MIB_OUTREQUESTS); |
1585 | err = NF_HOOK(PF_INET6, NF_INET_LOCAL_OUT, buff, NULL, dst->dev, | 1585 | err = NF_HOOK(PF_INET6, NF_INET_LOCAL_OUT, buff, NULL, dst->dev, |
1586 | dst_output); | 1586 | dst_output); |
1587 | if (!err) { | 1587 | if (!err) { |
diff --git a/net/ipv6/netfilter.c b/net/ipv6/netfilter.c index 4cb4844a3220..6b29b03925f1 100644 --- a/net/ipv6/netfilter.c +++ b/net/ipv6/netfilter.c | |||
@@ -33,7 +33,8 @@ int ip6_route_me_harder(struct sk_buff *skb) | |||
33 | #endif | 33 | #endif |
34 | 34 | ||
35 | if (dst->error) { | 35 | if (dst->error) { |
36 | IP6_INC_STATS(ip6_dst_idev(dst), IPSTATS_MIB_OUTNOROUTES); | 36 | IP6_INC_STATS(&init_net, ip6_dst_idev(dst), |
37 | IPSTATS_MIB_OUTNOROUTES); | ||
37 | LIMIT_NETDEBUG(KERN_DEBUG "ip6_route_me_harder: No more route.\n"); | 38 | LIMIT_NETDEBUG(KERN_DEBUG "ip6_route_me_harder: No more route.\n"); |
38 | dst_release(dst); | 39 | dst_release(dst); |
39 | return -EINVAL; | 40 | return -EINVAL; |
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index e53e493606c5..2ba04d41dc25 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c | |||
@@ -638,7 +638,7 @@ static int rawv6_send_hdrinc(struct sock *sk, void *from, int length, | |||
638 | if (err) | 638 | if (err) |
639 | goto error_fault; | 639 | goto error_fault; |
640 | 640 | ||
641 | IP6_INC_STATS(rt->rt6i_idev, IPSTATS_MIB_OUTREQUESTS); | 641 | IP6_INC_STATS(sock_net(sk), rt->rt6i_idev, IPSTATS_MIB_OUTREQUESTS); |
642 | err = NF_HOOK(PF_INET6, NF_INET_LOCAL_OUT, skb, NULL, rt->u.dst.dev, | 642 | err = NF_HOOK(PF_INET6, NF_INET_LOCAL_OUT, skb, NULL, rt->u.dst.dev, |
643 | dst_output); | 643 | dst_output); |
644 | if (err > 0) | 644 | if (err > 0) |
@@ -652,7 +652,7 @@ error_fault: | |||
652 | err = -EFAULT; | 652 | err = -EFAULT; |
653 | kfree_skb(skb); | 653 | kfree_skb(skb); |
654 | error: | 654 | error: |
655 | IP6_INC_STATS(rt->rt6i_idev, IPSTATS_MIB_OUTDISCARDS); | 655 | IP6_INC_STATS(sock_net(sk), rt->rt6i_idev, IPSTATS_MIB_OUTDISCARDS); |
656 | return err; | 656 | return err; |
657 | } | 657 | } |
658 | 658 | ||
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c index f4f62f086096..63644075f2d6 100644 --- a/net/ipv6/reassembly.c +++ b/net/ipv6/reassembly.c | |||
@@ -433,7 +433,8 @@ static int ip6_frag_queue(struct frag_queue *fq, struct sk_buff *skb, | |||
433 | return -1; | 433 | return -1; |
434 | 434 | ||
435 | err: | 435 | err: |
436 | IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_REASMFAILS); | 436 | IP6_INC_STATS(dev_net(skb->dst->dev), ip6_dst_idev(skb->dst), |
437 | IPSTATS_MIB_REASMFAILS); | ||
437 | kfree_skb(skb); | 438 | kfree_skb(skb); |
438 | return -1; | 439 | return -1; |
439 | } | 440 | } |
@@ -573,7 +574,7 @@ static int ipv6_frag_rcv(struct sk_buff *skb) | |||
573 | struct frag_hdr *fhdr; | 574 | struct frag_hdr *fhdr; |
574 | struct frag_queue *fq; | 575 | struct frag_queue *fq; |
575 | struct ipv6hdr *hdr = ipv6_hdr(skb); | 576 | struct ipv6hdr *hdr = ipv6_hdr(skb); |
576 | struct net *net; | 577 | struct net *net = dev_net(skb->dst->dev); |
577 | 578 | ||
578 | IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_REASMREQDS); | 579 | IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_REASMREQDS); |
579 | 580 | ||
@@ -597,7 +598,6 @@ static int ipv6_frag_rcv(struct sk_buff *skb) | |||
597 | return 1; | 598 | return 1; |
598 | } | 599 | } |
599 | 600 | ||
600 | net = dev_net(skb->dev); | ||
601 | if (atomic_read(&net->ipv6.frags.mem) > net->ipv6.frags.high_thresh) | 601 | if (atomic_read(&net->ipv6.frags.mem) > net->ipv6.frags.high_thresh) |
602 | ip6_evictor(net, ip6_dst_idev(skb->dst)); | 602 | ip6_evictor(net, ip6_dst_idev(skb->dst)); |
603 | 603 | ||
@@ -619,7 +619,7 @@ static int ipv6_frag_rcv(struct sk_buff *skb) | |||
619 | return -1; | 619 | return -1; |
620 | 620 | ||
621 | fail_hdr: | 621 | fail_hdr: |
622 | IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_INHDRERRORS); | 622 | IP6_INC_STATS(net, ip6_dst_idev(skb->dst), IPSTATS_MIB_INHDRERRORS); |
623 | icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, skb_network_header_len(skb)); | 623 | icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, skb_network_header_len(skb)); |
624 | return -1; | 624 | return -1; |
625 | } | 625 | } |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index e10a17015504..89dc69924340 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -1833,16 +1833,19 @@ int ipv6_route_ioctl(struct net *net, unsigned int cmd, void __user *arg) | |||
1833 | static int ip6_pkt_drop(struct sk_buff *skb, int code, int ipstats_mib_noroutes) | 1833 | static int ip6_pkt_drop(struct sk_buff *skb, int code, int ipstats_mib_noroutes) |
1834 | { | 1834 | { |
1835 | int type; | 1835 | int type; |
1836 | struct dst_entry *dst = skb->dst; | ||
1836 | switch (ipstats_mib_noroutes) { | 1837 | switch (ipstats_mib_noroutes) { |
1837 | case IPSTATS_MIB_INNOROUTES: | 1838 | case IPSTATS_MIB_INNOROUTES: |
1838 | type = ipv6_addr_type(&ipv6_hdr(skb)->daddr); | 1839 | type = ipv6_addr_type(&ipv6_hdr(skb)->daddr); |
1839 | if (type == IPV6_ADDR_ANY || type == IPV6_ADDR_RESERVED) { | 1840 | if (type == IPV6_ADDR_ANY || type == IPV6_ADDR_RESERVED) { |
1840 | IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_INADDRERRORS); | 1841 | IP6_INC_STATS(dev_net(dst->dev), ip6_dst_idev(dst), |
1842 | IPSTATS_MIB_INADDRERRORS); | ||
1841 | break; | 1843 | break; |
1842 | } | 1844 | } |
1843 | /* FALLTHROUGH */ | 1845 | /* FALLTHROUGH */ |
1844 | case IPSTATS_MIB_OUTNOROUTES: | 1846 | case IPSTATS_MIB_OUTNOROUTES: |
1845 | IP6_INC_STATS(ip6_dst_idev(skb->dst), ipstats_mib_noroutes); | 1847 | IP6_INC_STATS(dev_net(dst->dev), ip6_dst_idev(dst), |
1848 | ipstats_mib_noroutes); | ||
1846 | break; | 1849 | break; |
1847 | } | 1850 | } |
1848 | icmpv6_send(skb, ICMPV6_DEST_UNREACH, code, 0, skb->dev); | 1851 | icmpv6_send(skb, ICMPV6_DEST_UNREACH, code, 0, skb->dev); |