Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 6389
b: refs/heads/master
c: 5861524
h: refs/heads/master
i:
  6387: da8f602
v: v3
  • Loading branch information
Thomas Graf authored and David S. Miller committed Aug 29, 2005
1 parent fafdf9d commit 0c0142c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2c656491e9ce77e12337073973794c4be467a489
refs/heads/master: 58615242417638794a5ba299c49e3fbd6f47c2a3
27 changes: 13 additions & 14 deletions trunk/net/ipv4/ip_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ static inline int ip_rcv_finish(struct sk_buff *skb)
int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev)
{
struct iphdr *iph;
u32 len;

/* When the interface is in promisc. mode, drop all the crap
* that it receives, do not try to analyse it.
Expand Down Expand Up @@ -392,29 +393,27 @@ int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt,
*/

if (iph->ihl < 5 || iph->version != 4)
goto inhdr_error;
goto inhdr_error;

if (!pskb_may_pull(skb, iph->ihl*4))
goto inhdr_error;

iph = skb->nh.iph;

if (ip_fast_csum((u8 *)iph, iph->ihl) != 0)
goto inhdr_error;
goto inhdr_error;

{
__u32 len = ntohs(iph->tot_len);
if (skb->len < len || len < (iph->ihl<<2))
goto inhdr_error;
len = ntohs(iph->tot_len);
if (skb->len < len || len < (iph->ihl*4))
goto inhdr_error;

/* Our transport medium may have padded the buffer out. Now we know it
* is IP we can trim to the true length of the frame.
* Note this now means skb->len holds ntohs(iph->tot_len).
*/
if (pskb_trim_rcsum(skb, len)) {
IP_INC_STATS_BH(IPSTATS_MIB_INDISCARDS);
goto drop;
}
/* Our transport medium may have padded the buffer out. Now we know it
* is IP we can trim to the true length of the frame.
* Note this now means skb->len holds ntohs(iph->tot_len).
*/
if (pskb_trim_rcsum(skb, len)) {
IP_INC_STATS_BH(IPSTATS_MIB_INDISCARDS);
goto drop;
}

return NF_HOOK(PF_INET, NF_IP_PRE_ROUTING, skb, dev, NULL,
Expand Down

0 comments on commit 0c0142c

Please sign in to comment.