diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2008-07-06 00:18:48 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-07-06 00:18:48 -0400 |
commit | 0283328e2360bbf3081e97f1b720dd4c4dbae111 (patch) | |
tree | d0734e59c0900b3389ddcf469950715e60f537b4 /net/ipv4/udp.c | |
parent | 629ca23c331ec75ac87b016debbb3c4d2fe62650 (diff) |
MIB: add struct net to UDP_INC_STATS_BH
Two special cases here - one is rxrpc - I put init_net there
explicitly, since we haven't touched this part yet. The second
place is in __udp4_lib_rcv - we already have a struct net there,
but I have to move its initialization above to make it ready
at the "drop" label.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Acked-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/udp.c')
-rw-r--r-- | net/ipv4/udp.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index c97da5394d70..7187121e922d 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -991,7 +991,8 @@ int udp_queue_rcv_skb(struct sock * sk, struct sk_buff *skb) | |||
991 | 991 | ||
992 | ret = (*up->encap_rcv)(sk, skb); | 992 | ret = (*up->encap_rcv)(sk, skb); |
993 | if (ret <= 0) { | 993 | if (ret <= 0) { |
994 | UDP_INC_STATS_BH(UDP_MIB_INDATAGRAMS, | 994 | UDP_INC_STATS_BH(sock_net(sk), |
995 | UDP_MIB_INDATAGRAMS, | ||
995 | is_udplite); | 996 | is_udplite); |
996 | return -ret; | 997 | return -ret; |
997 | } | 998 | } |
@@ -1044,7 +1045,8 @@ int udp_queue_rcv_skb(struct sock * sk, struct sk_buff *skb) | |||
1044 | if ((rc = sock_queue_rcv_skb(sk,skb)) < 0) { | 1045 | if ((rc = sock_queue_rcv_skb(sk,skb)) < 0) { |
1045 | /* Note that an ENOMEM error is charged twice */ | 1046 | /* Note that an ENOMEM error is charged twice */ |
1046 | if (rc == -ENOMEM) { | 1047 | if (rc == -ENOMEM) { |
1047 | UDP_INC_STATS_BH(UDP_MIB_RCVBUFERRORS, is_udplite); | 1048 | UDP_INC_STATS_BH(sock_net(sk), |
1049 | UDP_MIB_RCVBUFERRORS, is_udplite); | ||
1048 | atomic_inc(&sk->sk_drops); | 1050 | atomic_inc(&sk->sk_drops); |
1049 | } | 1051 | } |
1050 | goto drop; | 1052 | goto drop; |
@@ -1053,7 +1055,7 @@ int udp_queue_rcv_skb(struct sock * sk, struct sk_buff *skb) | |||
1053 | return 0; | 1055 | return 0; |
1054 | 1056 | ||
1055 | drop: | 1057 | drop: |
1056 | UDP_INC_STATS_BH(UDP_MIB_INERRORS, is_udplite); | 1058 | UDP_INC_STATS_BH(sock_net(sk), UDP_MIB_INERRORS, is_udplite); |
1057 | kfree_skb(skb); | 1059 | kfree_skb(skb); |
1058 | return -1; | 1060 | return -1; |
1059 | } | 1061 | } |
@@ -1161,7 +1163,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[], | |||
1161 | struct rtable *rt = (struct rtable*)skb->dst; | 1163 | struct rtable *rt = (struct rtable*)skb->dst; |
1162 | __be32 saddr = ip_hdr(skb)->saddr; | 1164 | __be32 saddr = ip_hdr(skb)->saddr; |
1163 | __be32 daddr = ip_hdr(skb)->daddr; | 1165 | __be32 daddr = ip_hdr(skb)->daddr; |
1164 | struct net *net; | 1166 | struct net *net = dev_net(skb->dev); |
1165 | 1167 | ||
1166 | /* | 1168 | /* |
1167 | * Validate the packet. | 1169 | * Validate the packet. |
@@ -1183,7 +1185,6 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[], | |||
1183 | if (udp4_csum_init(skb, uh, proto)) | 1185 | if (udp4_csum_init(skb, uh, proto)) |
1184 | goto csum_error; | 1186 | goto csum_error; |
1185 | 1187 | ||
1186 | net = dev_net(skb->dev); | ||
1187 | if (rt->rt_flags & (RTCF_BROADCAST|RTCF_MULTICAST)) | 1188 | if (rt->rt_flags & (RTCF_BROADCAST|RTCF_MULTICAST)) |
1188 | return __udp4_lib_mcast_deliver(net, skb, uh, | 1189 | return __udp4_lib_mcast_deliver(net, skb, uh, |
1189 | saddr, daddr, udptable); | 1190 | saddr, daddr, udptable); |
@@ -1217,7 +1218,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[], | |||
1217 | if (udp_lib_checksum_complete(skb)) | 1218 | if (udp_lib_checksum_complete(skb)) |
1218 | goto csum_error; | 1219 | goto csum_error; |
1219 | 1220 | ||
1220 | UDP_INC_STATS_BH(UDP_MIB_NOPORTS, proto == IPPROTO_UDPLITE); | 1221 | UDP_INC_STATS_BH(net, UDP_MIB_NOPORTS, proto == IPPROTO_UDPLITE); |
1221 | icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH, 0); | 1222 | icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH, 0); |
1222 | 1223 | ||
1223 | /* | 1224 | /* |
@@ -1251,7 +1252,7 @@ csum_error: | |||
1251 | ntohs(uh->dest), | 1252 | ntohs(uh->dest), |
1252 | ulen); | 1253 | ulen); |
1253 | drop: | 1254 | drop: |
1254 | UDP_INC_STATS_BH(UDP_MIB_INERRORS, proto == IPPROTO_UDPLITE); | 1255 | UDP_INC_STATS_BH(net, UDP_MIB_INERRORS, proto == IPPROTO_UDPLITE); |
1255 | kfree_skb(skb); | 1256 | kfree_skb(skb); |
1256 | return 0; | 1257 | return 0; |
1257 | } | 1258 | } |
@@ -1458,7 +1459,8 @@ unsigned int udp_poll(struct file *file, struct socket *sock, poll_table *wait) | |||
1458 | spin_lock_bh(&rcvq->lock); | 1459 | spin_lock_bh(&rcvq->lock); |
1459 | while ((skb = skb_peek(rcvq)) != NULL && | 1460 | while ((skb = skb_peek(rcvq)) != NULL && |
1460 | udp_lib_checksum_complete(skb)) { | 1461 | udp_lib_checksum_complete(skb)) { |
1461 | UDP_INC_STATS_BH(UDP_MIB_INERRORS, is_lite); | 1462 | UDP_INC_STATS_BH(sock_net(sk), |
1463 | UDP_MIB_INERRORS, is_lite); | ||
1462 | __skb_unlink(skb, rcvq); | 1464 | __skb_unlink(skb, rcvq); |
1463 | kfree_skb(skb); | 1465 | kfree_skb(skb); |
1464 | } | 1466 | } |