diff options
Diffstat (limited to 'net/ipv4/ip_input.c')
| -rw-r--r-- | net/ipv4/ip_input.c | 14 |
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: | |||
| 329 | static inline int ip_rcv_finish(struct sk_buff *skb) | 329 | static 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 | ||
| 363 | drop: | 372 | drop: |
| @@ -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 |
