patch-2.1.79 linux/net/packet/af_packet.c

Next file: linux/net/rose/rose_dev.c
Previous file: linux/net/netsyms.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.78/linux/net/packet/af_packet.c linux/net/packet/af_packet.c
@@ -211,6 +211,11 @@
 	 *	so that this procedure is noop.
 	 */
 
+	if (skb->pkt_type == PACKET_LOOPBACK) {
+		kfree_skb(skb, FREE_READ);
+		return 0;
+	}
+
 	skb_push(skb, skb->data-skb->mac.raw);
 
 	/*
@@ -318,16 +323,14 @@
 	 * notable one here. This should really be fixed at the driver level.
 	 */
 	skb_reserve(skb,(dev->hard_header_len+15)&~15);
-	skb->mac.raw = skb->nh.raw = skb->data;
+	skb->nh.raw = skb->data;
 
 	/* Try to align data part correctly */
 	if (dev->hard_header) {
 		skb->data -= dev->hard_header_len;
 		skb->tail -= dev->hard_header_len;
-		skb->mac.raw = skb->data;
 	}
 	err = memcpy_fromiovec(skb_put(skb,len), msg->msg_iov, len);
-	skb->arp = 1;	/* No ARP needs doing on this (complete) frame */
 	skb->protocol = proto;
 	skb->dev = dev;
 	skb->priority = sk->priority;
@@ -372,9 +375,10 @@
 
 	sk = (struct sock *) pt->data;
 
-	/*
-	 *	The SOCK_PACKET socket receives _all_ frames.
-	 */
+	if (skb->pkt_type == PACKET_LOOPBACK) {
+		kfree_skb(skb, FREE_READ);
+		return 0;
+	}
 
 	skb->dev = dev;
 
@@ -469,7 +473,7 @@
 	}
 
 	skb_reserve(skb, (dev->hard_header_len+15)&~15);
-	skb->mac.raw = skb->nh.raw = skb->data;
+	skb->nh.raw = skb->data;
 
 	if (dev->hard_header) {
 		if (dev->hard_header(skb, dev, ntohs(proto),
@@ -480,7 +484,6 @@
 			dev_unlock_list();
 			return -EINVAL;
 		}
-		skb->mac.raw = skb->data;
 		if (sock->type != SOCK_DGRAM) {
 			skb->tail = skb->data;
 			skb->len = 0;
@@ -488,7 +491,6 @@
 	}
 
 	err = memcpy_fromiovec(skb_put(skb,len), msg->msg_iov, len);
-	skb->arp = 1;	/* No ARP needs doing on this (complete) frame */
 	skb->protocol = proto;
 	skb->dev = dev;
 	skb->priority = sk->priority;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov