patch-2.4.4 linux/net/ipv6/ip6_output.c

Next file: linux/net/ipv6/mcast.c
Previous file: linux/net/ipv6/ip6_input.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.3/linux/net/ipv6/ip6_output.c linux/net/ipv6/ip6_output.c
@@ -5,7 +5,7 @@
  *	Authors:
  *	Pedro Roque		<roque@di.fc.ul.pt>	
  *
- *	$Id: ip6_output.c,v 1.27 2000/06/21 17:18:40 davem Exp $
+ *	$Id: ip6_output.c,v 1.31 2001/04/17 20:39:51 davem Exp $
  *
  *	Based on linux/net/ipv4/ip_output.c
  *
@@ -22,6 +22,7 @@
  *				etc.
  *
  *      H. von Brand    :       Added missing #include <linux/string.h>
+ *	Imran Patel	: 	frag id should be in NBO
  */
 
 #include <linux/config.h>
@@ -55,7 +56,7 @@
 	static spinlock_t ip6_id_lock = SPIN_LOCK_UNLOCKED;
 
 	spin_lock_bh(&ip6_id_lock);
-	fhdr->identification = ipv6_fragmentation_id;
+	fhdr->identification = htonl(ipv6_fragmentation_id);
 	if (++ipv6_fragmentation_id == 0)
 		ipv6_fragmentation_id = 1;
 	spin_unlock_bh(&ip6_id_lock);
@@ -85,7 +86,7 @@
 static int ip6_dev_loopback_xmit(struct sk_buff *newskb)
 {
 	newskb->mac.raw = newskb->data;
-	skb_pull(newskb, newskb->nh.raw - newskb->data);
+	__skb_pull(newskb, newskb->nh.raw - newskb->data);
 	newskb->pkt_type = PACKET_LOOPBACK;
 	newskb->ip_summed = CHECKSUM_UNNECESSARY;
 	BUG_TRAP(newskb->dst);
@@ -113,7 +114,7 @@
 			   is not supported in any case.
 			 */
 			if (newskb)
-				NF_HOOK(PF_INET, NF_IP6_POST_ROUTING, newskb, NULL,
+				NF_HOOK(PF_INET6, NF_IP6_POST_ROUTING, newskb, NULL,
 					newskb->dev,
 					ip6_dev_loopback_xmit);
 
@@ -405,7 +406,7 @@
 
 	last_skb = sock_alloc_send_skb(sk, unfrag_len + frag_len +
 				       dst->dev->hard_header_len + 15,
-				       0, flags & MSG_DONTWAIT, &err);
+				       flags & MSG_DONTWAIT, &err);
 
 	if (last_skb == NULL)
 		return err;
@@ -624,7 +625,7 @@
 			goto out;
 
 		skb = sock_alloc_send_skb(sk, pktlength + 15 +
-					  dev->hard_header_len, 0,
+					  dev->hard_header_len,
 					  flags & MSG_DONTWAIT, &err);
 
 		if (skb == NULL) {
@@ -697,14 +698,14 @@
 			if (last) {
 				struct sk_buff *skb2 = skb_clone(skb, GFP_ATOMIC);
 				if (skb2)
-					rawv6_rcv(last, skb2, skb2->len);
+					rawv6_rcv(last, skb2);
 			}
 			last = sk;
 		}
 	}
 
 	if (last) {
-		rawv6_rcv(last, skb, skb->len);
+		rawv6_rcv(last, skb);
 		read_unlock(&ip6_ra_lock);
 		return 1;
 	}
@@ -724,7 +725,9 @@
 	struct inet6_skb_parm *opt =(struct inet6_skb_parm*)skb->cb;
 	
 	if (ipv6_devconf.forwarding == 0 && opt->srcrt == 0)
-		goto drop;
+		goto error;
+
+	skb->ip_summed = CHECKSUM_NONE;
 
 	/*
 	 *	We DO NOT make any processing on
@@ -785,7 +788,7 @@
 	} else if (ipv6_addr_type(&hdr->saddr)&(IPV6_ADDR_MULTICAST|IPV6_ADDR_LOOPBACK
 						|IPV6_ADDR_LINKLOCAL)) {
 		/* This check is security critical. */
-		goto drop;
+		goto error;
 	}
 
 	if (skb->len > dst->pmtu) {
@@ -797,8 +800,8 @@
 		return -EMSGSIZE;
 	}
 
-	if ((skb = skb_cow(skb, dst->dev->hard_header_len)) == NULL)
-		return 0;
+	if (skb_cow(skb, dst->dev->hard_header_len))
+		goto drop;
 
 	hdr = skb->nh.ipv6h;
 
@@ -809,8 +812,9 @@
 	IP6_INC_STATS_BH(Ip6OutForwDatagrams);
 	return NF_HOOK(PF_INET6,NF_IP6_FORWARD, skb, skb->dev, dst->dev, ip6_forward_finish);
 
-drop:
+error:
 	IP6_INC_STATS_BH(Ip6InAddrErrors);
+drop:
 	kfree_skb(skb);
 	return -EINVAL;
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)