[Bluetooth] Remove global conf_mtu variable from L2CAP
[pandora-kernel.git] / net / ipv4 / ip_input.c
index 324e7e0..168c871 100644 (file)
@@ -172,8 +172,7 @@ int ip_call_ra_chain(struct sk_buff *skb)
                    (!sk->sk_bound_dev_if ||
                     sk->sk_bound_dev_if == skb->dev->ifindex)) {
                        if (ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET)) {
-                               skb = ip_defrag(skb, IP_DEFRAG_CALL_RA_CHAIN);
-                               if (skb == NULL) {
+                               if (ip_defrag(skb, IP_DEFRAG_CALL_RA_CHAIN)) {
                                        read_unlock(&ip_ra_lock);
                                        return 1;
                                }
@@ -196,7 +195,7 @@ int ip_call_ra_chain(struct sk_buff *skb)
        return 0;
 }
 
-static inline int ip_local_deliver_finish(struct sk_buff *skb)
+static int ip_local_deliver_finish(struct sk_buff *skb)
 {
        __skb_pull(skb, ip_hdrlen(skb));
 
@@ -265,8 +264,7 @@ int ip_local_deliver(struct sk_buff *skb)
         */
 
        if (ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET)) {
-               skb = ip_defrag(skb, IP_DEFRAG_LOCAL_DELIVER);
-               if (!skb)
+               if (ip_defrag(skb, IP_DEFRAG_LOCAL_DELIVER))
                        return 0;
        }
 
@@ -326,9 +324,10 @@ drop:
        return -1;
 }
 
-static inline int ip_rcv_finish(struct sk_buff *skb)
+static int ip_rcv_finish(struct sk_buff *skb)
 {
        const struct iphdr *iph = ip_hdr(skb);
+       struct rtable *rt;
 
        /*
         *      Initialise the virtual path cache for the packet. It describes
@@ -340,6 +339,8 @@ static inline int ip_rcv_finish(struct sk_buff *skb)
                if (unlikely(err)) {
                        if (err == -EHOSTUNREACH)
                                IP_INC_STATS_BH(IPSTATS_MIB_INADDRERRORS);
+                       else if (err == -ENETUNREACH)
+                               IP_INC_STATS_BH(IPSTATS_MIB_INNOROUTES);
                        goto drop;
                }
        }
@@ -358,6 +359,12 @@ static inline int ip_rcv_finish(struct sk_buff *skb)
        if (iph->ihl > 5 && ip_rcv_options(skb))
                goto drop;
 
+       rt = (struct rtable*)skb->dst;
+       if (rt->rt_type == RTN_MULTICAST)
+               IP_INC_STATS_BH(IPSTATS_MIB_INMCASTPKTS);
+       else if (rt->rt_type == RTN_BROADCAST)
+               IP_INC_STATS_BH(IPSTATS_MIB_INBCASTPKTS);
+
        return dst_input(skb);
 
 drop:
@@ -373,6 +380,9 @@ int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt,
        struct iphdr *iph;
        u32 len;
 
+       if (dev->nd_net != &init_net)
+               goto drop;
+
        /* When the interface is in promisc. mode, drop all the crap
         * that it receives, do not try to analyse it.
         */
@@ -414,7 +424,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