aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/ip_input.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-04-30 11:14:42 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-04-30 11:14:42 -0400
commit152a6a9da1bd3ed5dcbbf6ff17c7ebde0eb9a754 (patch)
treecad354802870b7d4bc0402a6a6da44bd1f610bc6 /net/ipv4/ip_input.c
parentcd9bb7e7367c03400d6e918fd3502820fc3b9084 (diff)
parent80787ebc2bbd8e675d8b9ff8cfa40f15134feebe (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6: (21 commits) [IPV4] SNMP: Support OutMcastPkts and OutBcastPkts [IPV4] SNMP: Support InMcastPkts and InBcastPkts [IPV4] SNMP: Support InTruncatedPkts [IPV4] SNMP: Support InNoRoutes [SNMP]: Add definitions for {In,Out}BcastPkts [TCP] FRTO: RFC4138 allows Nagle override when new data must be sent [TCP] FRTO: Delay skb available check until it's mandatory [XFRM]: Restrict upper layer information by bundle. [TCP]: Catch skb with S+L bugs earlier [PATCH] INET : IPV4 UDP lookups converted to a 2 pass algo [L2TP]: Add the ability to autoload a pppox protocol module. [SKB]: Introduce skb_queue_walk_safe() [AF_IUCV/IUCV]: smp_call_function deadlock [IPV6]: Fix slab corruption running ip6sic [TCP]: Update references in two old comments [XFRM]: Export SPD info [IPV6]: Track device renames in snmp6. [SCTP]: Fix sctp_getsockopt_local_addrs_old() to use local storage. [NET]: Remove NETIF_F_INTERNAL_STATS, default to internal stats. [NETPOLL]: Remove CONFIG_NETPOLL_RX ...
Diffstat (limited to 'net/ipv4/ip_input.c')
-rw-r--r--net/ipv4/ip_input.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
index 324e7e0fdb2a..97069399d864 100644
--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -329,6 +329,7 @@ drop:
329static inline int ip_rcv_finish(struct sk_buff *skb) 329static inline int ip_rcv_finish(struct sk_buff *skb)
330{ 330{
331 const struct iphdr *iph = ip_hdr(skb); 331 const struct iphdr *iph = ip_hdr(skb);
332 struct rtable *rt;
332 333
333 /* 334 /*
334 * Initialise the virtual path cache for the packet. It describes 335 * Initialise the virtual path cache for the packet. It describes
@@ -340,6 +341,8 @@ static inline int ip_rcv_finish(struct sk_buff *skb)
340 if (unlikely(err)) { 341 if (unlikely(err)) {
341 if (err == -EHOSTUNREACH) 342 if (err == -EHOSTUNREACH)
342 IP_INC_STATS_BH(IPSTATS_MIB_INADDRERRORS); 343 IP_INC_STATS_BH(IPSTATS_MIB_INADDRERRORS);
344 else if (err == -ENETUNREACH)
345 IP_INC_STATS_BH(IPSTATS_MIB_INNOROUTES);
343 goto drop; 346 goto drop;
344 } 347 }
345 } 348 }
@@ -358,6 +361,12 @@ static inline int ip_rcv_finish(struct sk_buff *skb)
358 if (iph->ihl > 5 && ip_rcv_options(skb)) 361 if (iph->ihl > 5 && ip_rcv_options(skb))
359 goto drop; 362 goto drop;
360 363
364 rt = (struct rtable*)skb->dst;
365 if (rt->rt_type == RTN_MULTICAST)
366 IP_INC_STATS_BH(IPSTATS_MIB_INMCASTPKTS);
367 else if (rt->rt_type == RTN_BROADCAST)
368 IP_INC_STATS_BH(IPSTATS_MIB_INBCASTPKTS);
369
361 return dst_input(skb); 370 return dst_input(skb);
362 371
363drop: 372drop:
@@ -414,7 +423,10 @@ int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt,
414 goto inhdr_error; 423 goto inhdr_error;
415 424
416 len = ntohs(iph->tot_len); 425 len = ntohs(iph->tot_len);
417 if (skb->len < len || len < (iph->ihl*4)) 426 if (skb->len < len) {
427 IP_INC_STATS_BH(IPSTATS_MIB_INTRUNCATEDPKTS);
428 goto drop;
429 } else if (len < (iph->ihl*4))
418 goto inhdr_error; 430 goto inhdr_error;
419 431
420 /* Our transport medium may have padded the buffer out. Now we know it 432 /* Our transport medium may have padded the buffer out. Now we know it