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

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

diff -u --recursive --new-file v1.3.5/linux/net/ipv4/icmp.c linux/net/ipv4/icmp.c
@@ -112,7 +112,7 @@
 	 *	Find the original IP header.
 	 */
 	 
-	iph = (struct iphdr *) (skb_in->data + dev->hard_header_len);
+	iph = (struct iphdr *) skb_in->data;
 	
 	/*
 	 *	No replies to MAC multicast
@@ -243,7 +243,7 @@
 	 *	Re-adjust length according to actual IP header size. 
 	 */
 
-	skb->len = offset + sizeof(struct icmphdr) + sizeof(struct iphdr) + 8;
+	skb_put(skb,sizeof(struct icmphdr) + sizeof(struct iphdr) + 8);
 	
 	/*
 	 *	Fill in the frame
@@ -350,7 +350,9 @@
 static void icmp_redirect(struct icmphdr *icmph, struct sk_buff *skb,
 	struct device *dev, unsigned long source)
 {
+#ifndef CONFIG_IP_FORWARD
 	struct rtable *rt;
+#endif
 	struct iphdr *iph;
 	unsigned long ip;
 
@@ -377,7 +379,7 @@
 			 */
 #ifdef not_a_good_idea
 			ip_rt_add((RTF_DYNAMIC | RTF_MODIFIED | RTF_GATEWAY),
-				ip, 0, icmph->un.gateway, dev,0, 0);
+				ip, 0, icmph->un.gateway, dev,0, 0, 0);
 			break;
 #endif
 		case ICMP_REDIR_HOST:
@@ -398,7 +400,7 @@
 				break;
 			printk("ICMP redirect from %s\n", in_ntoa(source));
 			ip_rt_add((RTF_DYNAMIC | RTF_MODIFIED | RTF_HOST | RTF_GATEWAY),
-				ip, 0, icmph->un.gateway, dev,0, 0, 0);
+				ip, 0, icmph->un.gateway, dev,0, 0, 0, 0);
 			break;
 		case ICMP_REDIR_NETTOS:
 		case ICMP_REDIR_HOSTTOS:
@@ -459,7 +461,7 @@
 	 *	Re-adjust length according to actual IP header size. 
 	 */
 	 
-	skb2->len = offset + len;
+	skb_put(skb2,len);
 
 	/*
 	 *	Build ICMP_ECHO Response message. 
@@ -497,15 +499,13 @@
 	unsigned long *timeptr, midtime;
 	struct device *ndev=NULL;
 
-        if (len != 20)
+        if (len < 12)
 	{
 		printk(
 		  "ICMP: Size (%d) of ICMP_TIMESTAMP request should be 20!\n",
 		  len);
 		icmp_statistics.IcmpInErrors++;		
                 /* correct answers are possible for everything >= 12 */
-	  	if (len < 12)
-			return;
 	}
 
 	size = dev->hard_header_len + 84;
@@ -537,7 +537,7 @@
 	/*
 	 *	Re-adjust length according to actual IP header size. 
 	 */
-	skb2->len = offset + 20;
+	skb_put(skb2,20);
  
 	/*
 	 *	Build ICMP_TIMESTAMP Response message. 
@@ -628,7 +628,7 @@
 	 *	Re-adjust length according to actual IP header size. 
 	 */
 
-	skb2->len = offset + len;
+	skb_put(skb2,len);
 
 	/*
 	 *	Build ICMP ADDRESS MASK Response message. 

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