patch-1.3.6 linux/net/ipv4/arp.c

Next file: linux/net/ipv4/icmp.c
Previous file: linux/net/ipv4/af_inet.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.5/linux/net/ipv4/arp.c linux/net/ipv4/arp.c
@@ -333,7 +333,8 @@
 		printk("ARP: no memory to send an arp packet\n");
 		return;
 	}
-	skb->len = sizeof(struct arphdr) + dev->hard_header_len + 2*(dev->addr_len+4);
+	skb_reserve(skb, dev->hard_header_len);
+	arp = (struct arphdr *) skb_put(skb,sizeof(struct arphdr) + 2*(dev->addr_len+4));
 	skb->arp = 1;
 	skb->dev = dev;
 	skb->free = 1;
@@ -342,10 +343,9 @@
 	 *	Fill the device header for the ARP frame
 	 */
 
-	dev->hard_header(skb->data,dev,ptype,dest_hw?dest_hw:dev->broadcast,src_hw?src_hw:NULL,skb->len,skb);
+	dev->hard_header(skb,dev,ptype,dest_hw?dest_hw:dev->broadcast,src_hw?src_hw:NULL,skb->len);
 
 	/* Fill out the arp protocol part. */
-	arp = (struct arphdr *) (skb->data + dev->hard_header_len);
 	arp->ar_hrd = htons(dev->type);
 #ifdef CONFIG_AX25
 #ifdef CONFIG_NETROM
@@ -573,7 +573,12 @@
 	unsigned char ha[MAX_ADDR_LEN];	/* So we can enable ints again. */
 	long sip,tip;
 	unsigned char *sha,*tha;
-
+	
+/*
+ *	ARP carries the MAC addresses wrapped in the packet. We can't sanity
+ *	check this as proxy arp has them different.
+ */
+	skb_pull(skb,dev->hard_header_len);
 /*
  *	The hardware length of the packet should match the hardware length
  *	of the device.  Similarly, the hardware types should match.  The

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this