提交 3bd653c8 编写于 作者: D Denis V. Lunev 提交者: David S. Miller

netns: add net parameter to IP6_INC_STATS

Signed-off-by: NDenis V. Lunev <den@openvz.org>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 98b3377c
...@@ -129,7 +129,8 @@ extern struct ctl_path net_ipv6_ctl_path[]; ...@@ -129,7 +129,8 @@ extern struct ctl_path net_ipv6_ctl_path[];
/* MIBs */ /* MIBs */
DECLARE_SNMP_STAT(struct ipstats_mib, ipv6_statistics); DECLARE_SNMP_STAT(struct ipstats_mib, ipv6_statistics);
#define IP6_INC_STATS(idev,field) _DEVINC(ipv6, , idev, field) #define IP6_INC_STATS(net, idev,field) ({ (void)(net); \
_DEVINC(ipv6, , idev, field); })
#define IP6_INC_STATS_BH(idev,field) _DEVINC(ipv6, _BH, idev, field) #define IP6_INC_STATS_BH(idev,field) _DEVINC(ipv6, _BH, idev, field)
#define IP6_ADD_STATS_BH(idev,field,val) _DEVADD(ipv6, _BH, idev, field, val) #define IP6_ADD_STATS_BH(idev,field,val) _DEVADD(ipv6, _BH, idev, field, val)
......
...@@ -183,7 +183,7 @@ static inline int icmpv6_xrlim_allow(struct sock *sk, int type, ...@@ -183,7 +183,7 @@ static inline int icmpv6_xrlim_allow(struct sock *sk, int type,
*/ */
dst = ip6_route_output(net, sk, fl); dst = ip6_route_output(net, sk, fl);
if (dst->error) { if (dst->error) {
IP6_INC_STATS(ip6_dst_idev(dst), IP6_INC_STATS(net, ip6_dst_idev(dst),
IPSTATS_MIB_OUTNOROUTES); IPSTATS_MIB_OUTNOROUTES);
} else if (dst->dev && (dst->dev->flags&IFF_LOOPBACK)) { } else if (dst->dev && (dst->dev->flags&IFF_LOOPBACK)) {
res = 1; res = 1;
......
...@@ -150,13 +150,14 @@ static int ip6_output2(struct sk_buff *skb) ...@@ -150,13 +150,14 @@ static int ip6_output2(struct sk_buff *skb)
ip6_dev_loopback_xmit); ip6_dev_loopback_xmit);
if (ipv6_hdr(skb)->hop_limit == 0) { if (ipv6_hdr(skb)->hop_limit == 0) {
IP6_INC_STATS(idev, IPSTATS_MIB_OUTDISCARDS); IP6_INC_STATS(dev_net(dev), idev,
IPSTATS_MIB_OUTDISCARDS);
kfree_skb(skb); kfree_skb(skb);
return 0; return 0;
} }
} }
IP6_INC_STATS(idev, IPSTATS_MIB_OUTMCASTPKTS); IP6_INC_STATS(dev_net(dev), idev, IPSTATS_MIB_OUTMCASTPKTS);
} }
return NF_HOOK(PF_INET6, NF_INET_POST_ROUTING, skb, NULL, skb->dev, 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,7 +176,8 @@ int ip6_output(struct sk_buff *skb)
{ {
struct inet6_dev *idev = ip6_dst_idev(skb->dst); struct inet6_dev *idev = ip6_dst_idev(skb->dst);
if (unlikely(idev->cnf.disable_ipv6)) { if (unlikely(idev->cnf.disable_ipv6)) {
IP6_INC_STATS(idev, IPSTATS_MIB_OUTDISCARDS); IP6_INC_STATS(dev_net(skb->dst->dev), idev,
IPSTATS_MIB_OUTDISCARDS);
kfree_skb(skb); kfree_skb(skb);
return 0; return 0;
} }
...@@ -194,6 +196,7 @@ int ip6_output(struct sk_buff *skb) ...@@ -194,6 +196,7 @@ int ip6_output(struct sk_buff *skb)
int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl, int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
struct ipv6_txoptions *opt, int ipfragok) struct ipv6_txoptions *opt, int ipfragok)
{ {
struct net *net = sock_net(sk);
struct ipv6_pinfo *np = inet6_sk(sk); struct ipv6_pinfo *np = inet6_sk(sk);
struct in6_addr *first_hop = &fl->fl6_dst; struct in6_addr *first_hop = &fl->fl6_dst;
struct dst_entry *dst = skb->dst; struct dst_entry *dst = skb->dst;
...@@ -216,7 +219,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl, ...@@ -216,7 +219,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
if (skb_headroom(skb) < head_room) { if (skb_headroom(skb) < head_room) {
struct sk_buff *skb2 = skb_realloc_headroom(skb, head_room); struct sk_buff *skb2 = skb_realloc_headroom(skb, head_room);
if (skb2 == NULL) { if (skb2 == NULL) {
IP6_INC_STATS(ip6_dst_idev(skb->dst), IP6_INC_STATS(net, ip6_dst_idev(skb->dst),
IPSTATS_MIB_OUTDISCARDS); IPSTATS_MIB_OUTDISCARDS);
kfree_skb(skb); kfree_skb(skb);
return -ENOBUFS; return -ENOBUFS;
...@@ -270,7 +273,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl, ...@@ -270,7 +273,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
mtu = dst_mtu(dst); mtu = dst_mtu(dst);
if ((skb->len <= mtu) || skb->local_df || skb_is_gso(skb)) { if ((skb->len <= mtu) || skb->local_df || skb_is_gso(skb)) {
IP6_INC_STATS(ip6_dst_idev(skb->dst), IP6_INC_STATS(net, ip6_dst_idev(skb->dst),
IPSTATS_MIB_OUTREQUESTS); IPSTATS_MIB_OUTREQUESTS);
return NF_HOOK(PF_INET6, NF_INET_LOCAL_OUT, skb, NULL, dst->dev, return NF_HOOK(PF_INET6, NF_INET_LOCAL_OUT, skb, NULL, dst->dev,
dst_output); dst_output);
...@@ -280,7 +283,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl, ...@@ -280,7 +283,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
printk(KERN_DEBUG "IPv6: sending pkt_too_big to self\n"); printk(KERN_DEBUG "IPv6: sending pkt_too_big to self\n");
skb->dev = dst->dev; skb->dev = dst->dev;
icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, skb->dev); icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, skb->dev);
IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_FRAGFAILS); IP6_INC_STATS(net, ip6_dst_idev(skb->dst), IPSTATS_MIB_FRAGFAILS);
kfree_skb(skb); kfree_skb(skb);
return -EMSGSIZE; return -EMSGSIZE;
} }
...@@ -422,7 +425,7 @@ int ip6_forward(struct sk_buff *skb) ...@@ -422,7 +425,7 @@ int ip6_forward(struct sk_buff *skb)
goto drop; goto drop;
if (!xfrm6_policy_check(NULL, XFRM_POLICY_FWD, skb)) { if (!xfrm6_policy_check(NULL, XFRM_POLICY_FWD, skb)) {
IP6_INC_STATS(ip6_dst_idev(dst), IPSTATS_MIB_INDISCARDS); IP6_INC_STATS(net, ip6_dst_idev(dst), IPSTATS_MIB_INDISCARDS);
goto drop; goto drop;
} }
...@@ -468,13 +471,14 @@ int ip6_forward(struct sk_buff *skb) ...@@ -468,13 +471,14 @@ int ip6_forward(struct sk_buff *skb)
if (proxied > 0) if (proxied > 0)
return ip6_input(skb); return ip6_input(skb);
else if (proxied < 0) { else if (proxied < 0) {
IP6_INC_STATS(ip6_dst_idev(dst), IPSTATS_MIB_INDISCARDS); IP6_INC_STATS(net, ip6_dst_idev(dst),
IPSTATS_MIB_INDISCARDS);
goto drop; goto drop;
} }
} }
if (!xfrm6_route_forward(skb)) { if (!xfrm6_route_forward(skb)) {
IP6_INC_STATS(ip6_dst_idev(dst), IPSTATS_MIB_INDISCARDS); IP6_INC_STATS(net, ip6_dst_idev(dst), IPSTATS_MIB_INDISCARDS);
goto drop; goto drop;
} }
dst = skb->dst; dst = skb->dst;
...@@ -530,7 +534,7 @@ int ip6_forward(struct sk_buff *skb) ...@@ -530,7 +534,7 @@ int ip6_forward(struct sk_buff *skb)
} }
if (skb_cow(skb, dst->dev->hard_header_len)) { if (skb_cow(skb, dst->dev->hard_header_len)) {
IP6_INC_STATS(ip6_dst_idev(dst), IPSTATS_MIB_OUTDISCARDS); IP6_INC_STATS(net, ip6_dst_idev(dst), IPSTATS_MIB_OUTDISCARDS);
goto drop; goto drop;
} }
...@@ -622,6 +626,7 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)) ...@@ -622,6 +626,7 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
__be32 frag_id = 0; __be32 frag_id = 0;
int ptr, offset = 0, err=0; int ptr, offset = 0, err=0;
u8 *prevhdr, nexthdr = 0; u8 *prevhdr, nexthdr = 0;
struct net *net = dev_net(skb->dst->dev);
hlen = ip6_find_1stfragopt(skb, &prevhdr); hlen = ip6_find_1stfragopt(skb, &prevhdr);
nexthdr = *prevhdr; nexthdr = *prevhdr;
...@@ -635,7 +640,8 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)) ...@@ -635,7 +640,8 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
if (!skb->local_df) { if (!skb->local_df) {
skb->dev = skb->dst->dev; skb->dev = skb->dst->dev;
icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, skb->dev); icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, skb->dev);
IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_FRAGFAILS); IP6_INC_STATS(net, ip6_dst_idev(skb->dst),
IPSTATS_MIB_FRAGFAILS);
kfree_skb(skb); kfree_skb(skb);
return -EMSGSIZE; return -EMSGSIZE;
} }
...@@ -684,7 +690,8 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)) ...@@ -684,7 +690,8 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
*prevhdr = NEXTHDR_FRAGMENT; *prevhdr = NEXTHDR_FRAGMENT;
tmp_hdr = kmemdup(skb_network_header(skb), hlen, GFP_ATOMIC); tmp_hdr = kmemdup(skb_network_header(skb), hlen, GFP_ATOMIC);
if (!tmp_hdr) { if (!tmp_hdr) {
IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_FRAGFAILS); IP6_INC_STATS(net, ip6_dst_idev(skb->dst),
IPSTATS_MIB_FRAGFAILS);
return -ENOMEM; return -ENOMEM;
} }
...@@ -735,7 +742,8 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)) ...@@ -735,7 +742,8 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
err = output(skb); err = output(skb);
if(!err) if(!err)
IP6_INC_STATS(ip6_dst_idev(&rt->u.dst), IPSTATS_MIB_FRAGCREATES); IP6_INC_STATS(net, ip6_dst_idev(&rt->u.dst),
IPSTATS_MIB_FRAGCREATES);
if (err || !frag) if (err || !frag)
break; break;
...@@ -748,7 +756,8 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)) ...@@ -748,7 +756,8 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
kfree(tmp_hdr); kfree(tmp_hdr);
if (err == 0) { if (err == 0) {
IP6_INC_STATS(ip6_dst_idev(&rt->u.dst), IPSTATS_MIB_FRAGOKS); IP6_INC_STATS(net, ip6_dst_idev(&rt->u.dst),
IPSTATS_MIB_FRAGOKS);
dst_release(&rt->u.dst); dst_release(&rt->u.dst);
return 0; return 0;
} }
...@@ -759,7 +768,8 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)) ...@@ -759,7 +768,8 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
frag = skb; frag = skb;
} }
IP6_INC_STATS(ip6_dst_idev(&rt->u.dst), IPSTATS_MIB_FRAGFAILS); IP6_INC_STATS(net, ip6_dst_idev(&rt->u.dst),
IPSTATS_MIB_FRAGFAILS);
dst_release(&rt->u.dst); dst_release(&rt->u.dst);
return err; return err;
} }
...@@ -793,7 +803,7 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)) ...@@ -793,7 +803,7 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
if ((frag = alloc_skb(len+hlen+sizeof(struct frag_hdr)+LL_ALLOCATED_SPACE(rt->u.dst.dev), GFP_ATOMIC)) == NULL) { if ((frag = alloc_skb(len+hlen+sizeof(struct frag_hdr)+LL_ALLOCATED_SPACE(rt->u.dst.dev), GFP_ATOMIC)) == NULL) {
NETDEBUG(KERN_INFO "IPv6: frag: no memory for new fragment!\n"); NETDEBUG(KERN_INFO "IPv6: frag: no memory for new fragment!\n");
IP6_INC_STATS(ip6_dst_idev(skb->dst), IP6_INC_STATS(net, ip6_dst_idev(skb->dst),
IPSTATS_MIB_FRAGFAILS); IPSTATS_MIB_FRAGFAILS);
err = -ENOMEM; err = -ENOMEM;
goto fail; goto fail;
...@@ -857,15 +867,16 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)) ...@@ -857,15 +867,16 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
if (err) if (err)
goto fail; goto fail;
IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_FRAGCREATES); IP6_INC_STATS(net, ip6_dst_idev(skb->dst),
IPSTATS_MIB_FRAGCREATES);
} }
IP6_INC_STATS(ip6_dst_idev(skb->dst), IP6_INC_STATS(net, ip6_dst_idev(skb->dst),
IPSTATS_MIB_FRAGOKS); IPSTATS_MIB_FRAGOKS);
kfree_skb(skb); kfree_skb(skb);
return err; return err;
fail: fail:
IP6_INC_STATS(ip6_dst_idev(skb->dst), IP6_INC_STATS(net, ip6_dst_idev(skb->dst),
IPSTATS_MIB_FRAGFAILS); IPSTATS_MIB_FRAGFAILS);
kfree_skb(skb); kfree_skb(skb);
return err; return err;
...@@ -1385,7 +1396,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, ...@@ -1385,7 +1396,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,
return 0; return 0;
error: error:
inet->cork.length -= length; inet->cork.length -= length;
IP6_INC_STATS(rt->rt6i_idev, IPSTATS_MIB_OUTDISCARDS); IP6_INC_STATS(sock_net(sk), rt->rt6i_idev, IPSTATS_MIB_OUTDISCARDS);
return err; return err;
} }
...@@ -1409,6 +1420,7 @@ int ip6_push_pending_frames(struct sock *sk) ...@@ -1409,6 +1420,7 @@ int ip6_push_pending_frames(struct sock *sk)
struct in6_addr final_dst_buf, *final_dst = &final_dst_buf; struct in6_addr final_dst_buf, *final_dst = &final_dst_buf;
struct inet_sock *inet = inet_sk(sk); struct inet_sock *inet = inet_sk(sk);
struct ipv6_pinfo *np = inet6_sk(sk); struct ipv6_pinfo *np = inet6_sk(sk);
struct net *net = sock_net(sk);
struct ipv6hdr *hdr; struct ipv6hdr *hdr;
struct ipv6_txoptions *opt = np->cork.opt; struct ipv6_txoptions *opt = np->cork.opt;
struct rt6_info *rt = (struct rt6_info *)inet->cork.dst; struct rt6_info *rt = (struct rt6_info *)inet->cork.dst;
...@@ -1462,7 +1474,7 @@ int ip6_push_pending_frames(struct sock *sk) ...@@ -1462,7 +1474,7 @@ int ip6_push_pending_frames(struct sock *sk)
skb->mark = sk->sk_mark; skb->mark = sk->sk_mark;
skb->dst = dst_clone(&rt->u.dst); skb->dst = dst_clone(&rt->u.dst);
IP6_INC_STATS(rt->rt6i_idev, IPSTATS_MIB_OUTREQUESTS); IP6_INC_STATS(net, rt->rt6i_idev, IPSTATS_MIB_OUTREQUESTS);
if (proto == IPPROTO_ICMPV6) { if (proto == IPPROTO_ICMPV6) {
struct inet6_dev *idev = ip6_dst_idev(skb->dst); struct inet6_dev *idev = ip6_dst_idev(skb->dst);
...@@ -1491,7 +1503,7 @@ void ip6_flush_pending_frames(struct sock *sk) ...@@ -1491,7 +1503,7 @@ void ip6_flush_pending_frames(struct sock *sk)
while ((skb = __skb_dequeue_tail(&sk->sk_write_queue)) != NULL) { while ((skb = __skb_dequeue_tail(&sk->sk_write_queue)) != NULL) {
if (skb->dst) if (skb->dst)
IP6_INC_STATS(ip6_dst_idev(skb->dst), IP6_INC_STATS(sock_net(sk), ip6_dst_idev(skb->dst),
IPSTATS_MIB_OUTDISCARDS); IPSTATS_MIB_OUTDISCARDS);
kfree_skb(skb); kfree_skb(skb);
} }
......
...@@ -1446,7 +1446,7 @@ static void mld_sendpack(struct sk_buff *skb) ...@@ -1446,7 +1446,7 @@ static void mld_sendpack(struct sk_buff *skb)
int err; int err;
struct flowi fl; struct flowi fl;
IP6_INC_STATS(idev, IPSTATS_MIB_OUTREQUESTS); IP6_INC_STATS(net, idev, IPSTATS_MIB_OUTREQUESTS);
payload_len = (skb->tail - skb->network_header) - sizeof(*pip6); payload_len = (skb->tail - skb->network_header) - sizeof(*pip6);
mldlen = skb->tail - skb->transport_header; mldlen = skb->tail - skb->transport_header;
pip6->payload_len = htons(payload_len); 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,7 +1771,7 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type)
struct flowi fl; struct flowi fl;
rcu_read_lock(); rcu_read_lock();
IP6_INC_STATS(__in6_dev_get(dev), IP6_INC_STATS(net, __in6_dev_get(dev),
IPSTATS_MIB_OUTREQUESTS); IPSTATS_MIB_OUTREQUESTS);
rcu_read_unlock(); rcu_read_unlock();
if (type == ICMPV6_MGM_REDUCTION) if (type == ICMPV6_MGM_REDUCTION)
...@@ -1787,7 +1787,7 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type) ...@@ -1787,7 +1787,7 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type)
if (skb == NULL) { if (skb == NULL) {
rcu_read_lock(); rcu_read_lock();
IP6_INC_STATS(__in6_dev_get(dev), IP6_INC_STATS(net, __in6_dev_get(dev),
IPSTATS_MIB_OUTDISCARDS); IPSTATS_MIB_OUTDISCARDS);
rcu_read_unlock(); rcu_read_unlock();
return; return;
...@@ -1841,9 +1841,9 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type) ...@@ -1841,9 +1841,9 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type)
if (!err) { if (!err) {
ICMP6MSGOUT_INC_STATS(idev, type); ICMP6MSGOUT_INC_STATS(idev, type);
ICMP6_INC_STATS(idev, ICMP6_MIB_OUTMSGS); ICMP6_INC_STATS(idev, ICMP6_MIB_OUTMSGS);
IP6_INC_STATS(idev, IPSTATS_MIB_OUTMCASTPKTS); IP6_INC_STATS(net, idev, IPSTATS_MIB_OUTMCASTPKTS);
} else } else
IP6_INC_STATS(idev, IPSTATS_MIB_OUTDISCARDS); IP6_INC_STATS(net, idev, IPSTATS_MIB_OUTDISCARDS);
if (likely(idev != NULL)) if (likely(idev != NULL))
in6_dev_put(idev); in6_dev_put(idev);
......
...@@ -516,7 +516,7 @@ static void __ndisc_send(struct net_device *dev, ...@@ -516,7 +516,7 @@ static void __ndisc_send(struct net_device *dev,
skb->dst = dst; skb->dst = dst;
idev = in6_dev_get(dst->dev); idev = in6_dev_get(dst->dev);
IP6_INC_STATS(idev, IPSTATS_MIB_OUTREQUESTS); IP6_INC_STATS(net, idev, IPSTATS_MIB_OUTREQUESTS);
err = NF_HOOK(PF_INET6, NF_INET_LOCAL_OUT, skb, NULL, dst->dev, err = NF_HOOK(PF_INET6, NF_INET_LOCAL_OUT, skb, NULL, dst->dev,
dst_output); dst_output);
...@@ -1581,7 +1581,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh, ...@@ -1581,7 +1581,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
buff->dst = dst; buff->dst = dst;
idev = in6_dev_get(dst->dev); idev = in6_dev_get(dst->dev);
IP6_INC_STATS(idev, IPSTATS_MIB_OUTREQUESTS); IP6_INC_STATS(net, idev, IPSTATS_MIB_OUTREQUESTS);
err = NF_HOOK(PF_INET6, NF_INET_LOCAL_OUT, buff, NULL, dst->dev, err = NF_HOOK(PF_INET6, NF_INET_LOCAL_OUT, buff, NULL, dst->dev,
dst_output); dst_output);
if (!err) { if (!err) {
......
...@@ -33,7 +33,8 @@ int ip6_route_me_harder(struct sk_buff *skb) ...@@ -33,7 +33,8 @@ int ip6_route_me_harder(struct sk_buff *skb)
#endif #endif
if (dst->error) { if (dst->error) {
IP6_INC_STATS(ip6_dst_idev(dst), IPSTATS_MIB_OUTNOROUTES); IP6_INC_STATS(&init_net, ip6_dst_idev(dst),
IPSTATS_MIB_OUTNOROUTES);
LIMIT_NETDEBUG(KERN_DEBUG "ip6_route_me_harder: No more route.\n"); LIMIT_NETDEBUG(KERN_DEBUG "ip6_route_me_harder: No more route.\n");
dst_release(dst); dst_release(dst);
return -EINVAL; return -EINVAL;
......
...@@ -638,7 +638,7 @@ static int rawv6_send_hdrinc(struct sock *sk, void *from, int length, ...@@ -638,7 +638,7 @@ static int rawv6_send_hdrinc(struct sock *sk, void *from, int length,
if (err) if (err)
goto error_fault; goto error_fault;
IP6_INC_STATS(rt->rt6i_idev, IPSTATS_MIB_OUTREQUESTS); IP6_INC_STATS(sock_net(sk), rt->rt6i_idev, IPSTATS_MIB_OUTREQUESTS);
err = NF_HOOK(PF_INET6, NF_INET_LOCAL_OUT, skb, NULL, rt->u.dst.dev, err = NF_HOOK(PF_INET6, NF_INET_LOCAL_OUT, skb, NULL, rt->u.dst.dev,
dst_output); dst_output);
if (err > 0) if (err > 0)
...@@ -652,7 +652,7 @@ static int rawv6_send_hdrinc(struct sock *sk, void *from, int length, ...@@ -652,7 +652,7 @@ static int rawv6_send_hdrinc(struct sock *sk, void *from, int length,
err = -EFAULT; err = -EFAULT;
kfree_skb(skb); kfree_skb(skb);
error: error:
IP6_INC_STATS(rt->rt6i_idev, IPSTATS_MIB_OUTDISCARDS); IP6_INC_STATS(sock_net(sk), rt->rt6i_idev, IPSTATS_MIB_OUTDISCARDS);
return err; return err;
} }
......
...@@ -433,7 +433,8 @@ static int ip6_frag_queue(struct frag_queue *fq, struct sk_buff *skb, ...@@ -433,7 +433,8 @@ static int ip6_frag_queue(struct frag_queue *fq, struct sk_buff *skb,
return -1; return -1;
err: err:
IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_REASMFAILS); IP6_INC_STATS(dev_net(skb->dst->dev), ip6_dst_idev(skb->dst),
IPSTATS_MIB_REASMFAILS);
kfree_skb(skb); kfree_skb(skb);
return -1; return -1;
} }
...@@ -573,7 +574,7 @@ static int ipv6_frag_rcv(struct sk_buff *skb) ...@@ -573,7 +574,7 @@ static int ipv6_frag_rcv(struct sk_buff *skb)
struct frag_hdr *fhdr; struct frag_hdr *fhdr;
struct frag_queue *fq; struct frag_queue *fq;
struct ipv6hdr *hdr = ipv6_hdr(skb); struct ipv6hdr *hdr = ipv6_hdr(skb);
struct net *net; struct net *net = dev_net(skb->dst->dev);
IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_REASMREQDS); IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_REASMREQDS);
...@@ -597,7 +598,6 @@ static int ipv6_frag_rcv(struct sk_buff *skb) ...@@ -597,7 +598,6 @@ static int ipv6_frag_rcv(struct sk_buff *skb)
return 1; return 1;
} }
net = dev_net(skb->dev);
if (atomic_read(&net->ipv6.frags.mem) > net->ipv6.frags.high_thresh) if (atomic_read(&net->ipv6.frags.mem) > net->ipv6.frags.high_thresh)
ip6_evictor(net, ip6_dst_idev(skb->dst)); ip6_evictor(net, ip6_dst_idev(skb->dst));
...@@ -619,7 +619,7 @@ static int ipv6_frag_rcv(struct sk_buff *skb) ...@@ -619,7 +619,7 @@ static int ipv6_frag_rcv(struct sk_buff *skb)
return -1; return -1;
fail_hdr: fail_hdr:
IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_INHDRERRORS); IP6_INC_STATS(net, ip6_dst_idev(skb->dst), IPSTATS_MIB_INHDRERRORS);
icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, skb_network_header_len(skb)); icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, skb_network_header_len(skb));
return -1; return -1;
} }
......
...@@ -1833,16 +1833,19 @@ int ipv6_route_ioctl(struct net *net, unsigned int cmd, void __user *arg) ...@@ -1833,16 +1833,19 @@ int ipv6_route_ioctl(struct net *net, unsigned int cmd, void __user *arg)
static int ip6_pkt_drop(struct sk_buff *skb, int code, int ipstats_mib_noroutes) static int ip6_pkt_drop(struct sk_buff *skb, int code, int ipstats_mib_noroutes)
{ {
int type; int type;
struct dst_entry *dst = skb->dst;
switch (ipstats_mib_noroutes) { switch (ipstats_mib_noroutes) {
case IPSTATS_MIB_INNOROUTES: case IPSTATS_MIB_INNOROUTES:
type = ipv6_addr_type(&ipv6_hdr(skb)->daddr); type = ipv6_addr_type(&ipv6_hdr(skb)->daddr);
if (type == IPV6_ADDR_ANY || type == IPV6_ADDR_RESERVED) { if (type == IPV6_ADDR_ANY || type == IPV6_ADDR_RESERVED) {
IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_INADDRERRORS); IP6_INC_STATS(dev_net(dst->dev), ip6_dst_idev(dst),
IPSTATS_MIB_INADDRERRORS);
break; break;
} }
/* FALLTHROUGH */ /* FALLTHROUGH */
case IPSTATS_MIB_OUTNOROUTES: case IPSTATS_MIB_OUTNOROUTES:
IP6_INC_STATS(ip6_dst_idev(skb->dst), ipstats_mib_noroutes); IP6_INC_STATS(dev_net(dst->dev), ip6_dst_idev(dst),
ipstats_mib_noroutes);
break; break;
} }
icmpv6_send(skb, ICMPV6_DEST_UNREACH, code, 0, skb->dev); icmpv6_send(skb, ICMPV6_DEST_UNREACH, code, 0, skb->dev);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册