diff options
Diffstat (limited to 'net/ipv4/ip_input.c')
-rw-r--r-- | net/ipv4/ip_input.c | 40 |
1 files changed, 16 insertions, 24 deletions
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c index ff77a4a7f9ec..e0bed56c51f1 100644 --- a/net/ipv4/ip_input.c +++ b/net/ipv4/ip_input.c | |||
@@ -5,8 +5,6 @@ | |||
5 | * | 5 | * |
6 | * The Internet Protocol (IP) module. | 6 | * The Internet Protocol (IP) module. |
7 | * | 7 | * |
8 | * Version: $Id: ip_input.c,v 1.55 2002/01/12 07:39:45 davem Exp $ | ||
9 | * | ||
10 | * Authors: Ross Biro | 8 | * Authors: Ross Biro |
11 | * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> | 9 | * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> |
12 | * Donald Becker, <becker@super.org> | 10 | * Donald Becker, <becker@super.org> |
@@ -147,12 +145,6 @@ | |||
147 | #include <linux/netlink.h> | 145 | #include <linux/netlink.h> |
148 | 146 | ||
149 | /* | 147 | /* |
150 | * SNMP management statistics | ||
151 | */ | ||
152 | |||
153 | DEFINE_SNMP_STAT(struct ipstats_mib, ip_statistics) __read_mostly; | ||
154 | |||
155 | /* | ||
156 | * Process Router Attention IP option | 148 | * Process Router Attention IP option |
157 | */ | 149 | */ |
158 | int ip_call_ra_chain(struct sk_buff *skb) | 150 | int ip_call_ra_chain(struct sk_buff *skb) |
@@ -232,16 +224,16 @@ static int ip_local_deliver_finish(struct sk_buff *skb) | |||
232 | protocol = -ret; | 224 | protocol = -ret; |
233 | goto resubmit; | 225 | goto resubmit; |
234 | } | 226 | } |
235 | IP_INC_STATS_BH(IPSTATS_MIB_INDELIVERS); | 227 | IP_INC_STATS_BH(net, IPSTATS_MIB_INDELIVERS); |
236 | } else { | 228 | } else { |
237 | if (!raw) { | 229 | if (!raw) { |
238 | if (xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) { | 230 | if (xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) { |
239 | IP_INC_STATS_BH(IPSTATS_MIB_INUNKNOWNPROTOS); | 231 | IP_INC_STATS_BH(net, IPSTATS_MIB_INUNKNOWNPROTOS); |
240 | icmp_send(skb, ICMP_DEST_UNREACH, | 232 | icmp_send(skb, ICMP_DEST_UNREACH, |
241 | ICMP_PROT_UNREACH, 0); | 233 | ICMP_PROT_UNREACH, 0); |
242 | } | 234 | } |
243 | } else | 235 | } else |
244 | IP_INC_STATS_BH(IPSTATS_MIB_INDELIVERS); | 236 | IP_INC_STATS_BH(net, IPSTATS_MIB_INDELIVERS); |
245 | kfree_skb(skb); | 237 | kfree_skb(skb); |
246 | } | 238 | } |
247 | } | 239 | } |
@@ -283,7 +275,7 @@ static inline int ip_rcv_options(struct sk_buff *skb) | |||
283 | --ANK (980813) | 275 | --ANK (980813) |
284 | */ | 276 | */ |
285 | if (skb_cow(skb, skb_headroom(skb))) { | 277 | if (skb_cow(skb, skb_headroom(skb))) { |
286 | IP_INC_STATS_BH(IPSTATS_MIB_INDISCARDS); | 278 | IP_INC_STATS_BH(dev_net(dev), IPSTATS_MIB_INDISCARDS); |
287 | goto drop; | 279 | goto drop; |
288 | } | 280 | } |
289 | 281 | ||
@@ -292,7 +284,7 @@ static inline int ip_rcv_options(struct sk_buff *skb) | |||
292 | opt->optlen = iph->ihl*4 - sizeof(struct iphdr); | 284 | opt->optlen = iph->ihl*4 - sizeof(struct iphdr); |
293 | 285 | ||
294 | if (ip_options_compile(dev_net(dev), opt, skb)) { | 286 | if (ip_options_compile(dev_net(dev), opt, skb)) { |
295 | IP_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS); | 287 | IP_INC_STATS_BH(dev_net(dev), IPSTATS_MIB_INHDRERRORS); |
296 | goto drop; | 288 | goto drop; |
297 | } | 289 | } |
298 | 290 | ||
@@ -336,9 +328,11 @@ static int ip_rcv_finish(struct sk_buff *skb) | |||
336 | skb->dev); | 328 | skb->dev); |
337 | if (unlikely(err)) { | 329 | if (unlikely(err)) { |
338 | if (err == -EHOSTUNREACH) | 330 | if (err == -EHOSTUNREACH) |
339 | IP_INC_STATS_BH(IPSTATS_MIB_INADDRERRORS); | 331 | IP_INC_STATS_BH(dev_net(skb->dev), |
332 | IPSTATS_MIB_INADDRERRORS); | ||
340 | else if (err == -ENETUNREACH) | 333 | else if (err == -ENETUNREACH) |
341 | IP_INC_STATS_BH(IPSTATS_MIB_INNOROUTES); | 334 | IP_INC_STATS_BH(dev_net(skb->dev), |
335 | IPSTATS_MIB_INNOROUTES); | ||
342 | goto drop; | 336 | goto drop; |
343 | } | 337 | } |
344 | } | 338 | } |
@@ -359,9 +353,9 @@ static int ip_rcv_finish(struct sk_buff *skb) | |||
359 | 353 | ||
360 | rt = skb->rtable; | 354 | rt = skb->rtable; |
361 | if (rt->rt_type == RTN_MULTICAST) | 355 | if (rt->rt_type == RTN_MULTICAST) |
362 | IP_INC_STATS_BH(IPSTATS_MIB_INMCASTPKTS); | 356 | IP_INC_STATS_BH(dev_net(rt->u.dst.dev), IPSTATS_MIB_INMCASTPKTS); |
363 | else if (rt->rt_type == RTN_BROADCAST) | 357 | else if (rt->rt_type == RTN_BROADCAST) |
364 | IP_INC_STATS_BH(IPSTATS_MIB_INBCASTPKTS); | 358 | IP_INC_STATS_BH(dev_net(rt->u.dst.dev), IPSTATS_MIB_INBCASTPKTS); |
365 | 359 | ||
366 | return dst_input(skb); | 360 | return dst_input(skb); |
367 | 361 | ||
@@ -384,10 +378,10 @@ int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, | |||
384 | if (skb->pkt_type == PACKET_OTHERHOST) | 378 | if (skb->pkt_type == PACKET_OTHERHOST) |
385 | goto drop; | 379 | goto drop; |
386 | 380 | ||
387 | IP_INC_STATS_BH(IPSTATS_MIB_INRECEIVES); | 381 | IP_INC_STATS_BH(dev_net(dev), IPSTATS_MIB_INRECEIVES); |
388 | 382 | ||
389 | if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) { | 383 | if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) { |
390 | IP_INC_STATS_BH(IPSTATS_MIB_INDISCARDS); | 384 | IP_INC_STATS_BH(dev_net(dev), IPSTATS_MIB_INDISCARDS); |
391 | goto out; | 385 | goto out; |
392 | } | 386 | } |
393 | 387 | ||
@@ -420,7 +414,7 @@ int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, | |||
420 | 414 | ||
421 | len = ntohs(iph->tot_len); | 415 | len = ntohs(iph->tot_len); |
422 | if (skb->len < len) { | 416 | if (skb->len < len) { |
423 | IP_INC_STATS_BH(IPSTATS_MIB_INTRUNCATEDPKTS); | 417 | IP_INC_STATS_BH(dev_net(dev), IPSTATS_MIB_INTRUNCATEDPKTS); |
424 | goto drop; | 418 | goto drop; |
425 | } else if (len < (iph->ihl*4)) | 419 | } else if (len < (iph->ihl*4)) |
426 | goto inhdr_error; | 420 | goto inhdr_error; |
@@ -430,7 +424,7 @@ int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, | |||
430 | * Note this now means skb->len holds ntohs(iph->tot_len). | 424 | * Note this now means skb->len holds ntohs(iph->tot_len). |
431 | */ | 425 | */ |
432 | if (pskb_trim_rcsum(skb, len)) { | 426 | if (pskb_trim_rcsum(skb, len)) { |
433 | IP_INC_STATS_BH(IPSTATS_MIB_INDISCARDS); | 427 | IP_INC_STATS_BH(dev_net(dev), IPSTATS_MIB_INDISCARDS); |
434 | goto drop; | 428 | goto drop; |
435 | } | 429 | } |
436 | 430 | ||
@@ -441,11 +435,9 @@ int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, | |||
441 | ip_rcv_finish); | 435 | ip_rcv_finish); |
442 | 436 | ||
443 | inhdr_error: | 437 | inhdr_error: |
444 | IP_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS); | 438 | IP_INC_STATS_BH(dev_net(dev), IPSTATS_MIB_INHDRERRORS); |
445 | drop: | 439 | drop: |
446 | kfree_skb(skb); | 440 | kfree_skb(skb); |
447 | out: | 441 | out: |
448 | return NET_RX_DROP; | 442 | return NET_RX_DROP; |
449 | } | 443 | } |
450 | |||
451 | EXPORT_SYMBOL(ip_statistics); | ||