Skip to content

Commit

Permalink
[IPV4] SNMP: Support InTruncatedPkts
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Mitsuru Chinen authored and David S. Miller committed Apr 30, 2007
1 parent e91a47e commit 704aed5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion net/ipv4/ip_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 704aed5

Please sign in to comment.