summaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorMitsuru Chinen2007-04-30 09:46:30 +0200
committerDavid S. Miller2007-04-30 09:58:26 +0200
commit704aed53b4e43bebfbd425cf95b66794a9cfa2c2 (patch)
tree14108e800c54dd199f254b086f13fe6206eefb9e /net/ipv4
parent[IPV4] SNMP: Support InNoRoutes (diff)
downloadkernel-qcow2-linux-704aed53b4e43bebfbd425cf95b66794a9cfa2c2.tar.gz
kernel-qcow2-linux-704aed53b4e43bebfbd425cf95b66794a9cfa2c2.tar.xz
kernel-qcow2-linux-704aed53b4e43bebfbd425cf95b66794a9cfa2c2.zip
[IPV4] SNMP: Support InTruncatedPkts
An IP datagram which is being discarded because the datagram frame didn't carry enough data should be counted as InTruncatedPkts. Signed-off-by: Mitsuru Chinen <mitch@linux.vnet.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/ip_input.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
index 63ab5230c611..c8c455dd9caf 100644
--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -416,7 +416,10 @@ int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt,
goto inhdr_error;
len = ntohs(iph->tot_len);
- if (skb->len < len || len < (iph->ihl*4))
+ if (skb->len < len) {
+ IP_INC_STATS_BH(IPSTATS_MIB_INTRUNCATEDPKTS);
+ goto drop;
+ } else if (len < (iph->ihl*4))
goto inhdr_error;
/* Our transport medium may have padded the buffer out. Now we know it