linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / net / packet / af_packet.c
index 4172a52..9db7dbd 100644 (file)
@@ -49,6 +49,7 @@
  *
  */
  
+#include <linux/config.h>
 #include <linux/types.h>
 #include <linux/sched.h>
 #include <linux/mm.h>
@@ -626,6 +627,8 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, struct packe
                if ((int)snaplen < 0)
                        snaplen = 0;
        }
+       if (snaplen > skb->len-skb->data_len)
+               snaplen = skb->len-skb->data_len;
 
        spin_lock(&sk->sk_receive_queue.lock);
        h = (struct tpacket_hdr *)packet_lookup_frame(po, po->head);
@@ -642,7 +645,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, struct packe
                status &= ~TP_STATUS_LOSING;
        spin_unlock(&sk->sk_receive_queue.lock);
 
-       skb_copy_bits(skb, 0, (u8*)h + macoff, snaplen);
+       memcpy((u8*)h + macoff, skb->data, snaplen);
 
        h->tp_len = skb->len;
        h->tp_snaplen = snaplen;