patch-1.3.16 linux/net/ipv4/ip.c

Next file: linux/net/ipv4/ip_fw.c
Previous file: linux/net/core/iovec.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.15/linux/net/ipv4/ip.c linux/net/ipv4/ip.c
@@ -223,7 +223,7 @@
 	 *	See if we need to look up the device.
 	 */
 
-#ifdef CONFIG_INET_MULTICAST	
+#ifdef CONFIG_IP_MULTICAST	
 	if(MULTICAST(daddr) && *dev==NULL && skb->sk && *skb->sk->ip_mc_name)
 		*dev=dev_get(skb->sk->ip_mc_name);
 #endif
@@ -854,9 +854,12 @@
 	 */
 
 	raw = skb->data;
-	iph = (struct iphdr *) (raw + dev->hard_header_len);
-
+#if 0
+	iph = (struct iphdr *) (raw + dev->hard_header_len);	
 	skb->ip_hdr = iph;
+#else
+	iph = skb->ip_hdr;
+#endif
 
 	/*
 	 *	Setup starting values.
@@ -1741,7 +1744,7 @@
 	      struct sk_buff *skb, int free)
 {
 	struct iphdr *iph;
-	unsigned char *ptr;
+/*	unsigned char *ptr;*/
 
 	/* Sanity check */
 	if (dev == NULL)
@@ -1768,11 +1771,15 @@
 	 *	header length problem
 	 */
 
+#if 0
 	ptr = skb->data;
 	ptr += dev->hard_header_len;
-	iph = (struct iphdr *)ptr;
+	iph = (struct iphdr *)ptr;	
 	skb->ip_hdr = iph;
-	iph->tot_len = ntohs(skb->len-dev->hard_header_len);
+#else
+	iph = skb->ip_hdr;
+#endif
+	iph->tot_len = ntohs(skb->len-(((unsigned char *)iph)-skb->data));
 
 #ifdef CONFIG_IP_FIREWALL
 	if(ip_fw_chk(iph, dev, ip_fw_blk_chain, ip_fw_blk_policy, 0) != 1)
@@ -1801,7 +1808,7 @@
 	 *	bits of it.
 	 */
 
-	if(skb->len > dev->mtu + dev->hard_header_len)
+	if(ntohs(iph->tot_len)> dev->mtu)
 	{
 		ip_fragment(sk,skb,dev,0);
 		IS_SKB(skb);
@@ -2370,13 +2377,17 @@
 	ip_statistics.IpOutRequests++;
 
 
-#ifdef CONFIG_INET_MULTICAST	
+#ifdef CONFIG_IP_MULTICAST	
 	if(sk && MULTICAST(daddr) && *sk->ip_mc_name)
 	{
-		dev=dev_get(skb->ip_mc_name);
+		dev=dev_get(sk->ip_mc_name);
 		if(!dev)
 			return -ENODEV;
 		rt=NULL;
+		if (sk->saddr && (!LOOPBACK(sk->saddr) || LOOPBACK(daddr)))
+			saddr = sk->saddr;
+		else
+			saddr = dev->pa_addr;
 	}
 	else
 	{
@@ -2438,7 +2449,7 @@
 			saddr = sk->saddr;
 			
 		dev=rt->rt_dev;
-#ifdef CONFIG_INET_MULTICAST
+#ifdef CONFIG_IP_MULTICAST
 	}
 #endif		
 
@@ -2691,15 +2702,15 @@
 			if(sk==NULL || sk->ip_mc_loop) 
 			{
 				if(skb->daddr==IGMP_ALL_HOSTS)
-					ip_loopback(rt->rt_dev,skb);
+					ip_loopback(rt?rt->rt_dev:dev,skb);
 				else 
 				{
-					struct ip_mc_list *imc=rt->rt_dev->ip_mc_list;
+					struct ip_mc_list *imc=rt?rt->rt_dev->ip_mc_list:dev->ip_mc_list;
 					while(imc!=NULL) 
 					{
 						if(imc->multiaddr==daddr) 
 						{
-							ip_loopback(rt->rt_dev,skb);
+							ip_loopback(rt?rt->rt_dev:dev,skb);
 							break;
 						}
 						imc=imc->next;

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