patch-2.1.79 linux/net/ipv6/raw.c

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

diff -u --recursive --new-file v2.1.78/linux/net/ipv6/raw.c linux/net/ipv6/raw.c
@@ -7,7 +7,7 @@
  *
  *	Adapted from linux/net/ipv4/raw.c
  *
- *	$Id: raw.c,v 1.13 1997/09/14 08:32:14 davem Exp $
+ *	$Id: raw.c,v 1.16 1997/12/29 19:52:48 kuznet Exp $
  *
  *	This program is free software; you can redistribute it and/or
  *      modify it under the terms of the GNU General Public License
@@ -25,6 +25,7 @@
 #include <linux/netdevice.h>
 #include <linux/if_arp.h>
 #include <linux/icmpv6.h>
+#include <asm/uaccess.h>
 
 #include <net/sock.h>
 #include <net/snmp.h>
@@ -165,7 +166,7 @@
 			 */
 			v4addr = LOOPBACK4_IPV6;
 			if (!(addr_type & IPV6_ADDR_MULTICAST))	{
-				if (ipv6_chk_addr(&addr->sin6_addr) == NULL)
+				if (ipv6_chk_addr(&addr->sin6_addr, NULL, 0) == NULL)
 					return(-EADDRNOTAVAIL);
 			}
 		}
@@ -359,7 +360,15 @@
 	int hlimit = -1;
 	u16 proto;
 	int err;
-	
+
+	/* Rough check on arithmetic overflow,
+	   better check is made in ip6_build_xmit
+
+	   When jumbo header will be implemeted we will remove it
+	   at all (len will be size_t)
+	 */
+	if (len < 0 || len > 0xFFFF)
+		return -EMSGSIZE;
 
 	/* Mirror BSD error message compatibility */
 	if (msg->msg_flags & MSG_OOB)		
@@ -389,9 +398,12 @@
 
 		daddr = &sin6->sin6_addr;
 		
-		if (np->dst && ipv6_addr_cmp(daddr, &np->daddr)) {
-			dst_release(np->dst);
-			np->dst = NULL;
+		/* BUGGGG If route is not cloned, this check always
+		   fails, hence dst_cache only slows down tramsmission --ANK
+		 */
+		if (sk->dst_cache && ipv6_addr_cmp(daddr, &np->daddr)) {
+			dst_release(sk->dst_cache);
+			sk->dst_cache = NULL;
 		}		
 	} else {
 		if (sk->state != TCP_ESTABLISHED) 
@@ -409,12 +421,6 @@
 		return(-EINVAL);
 	}
 
-	/*
-	 *	We don't allow > 64K sends yet.		 
-	 */
-	if (len + (sk->ip_hdrincl ? 0 : sizeof(struct ipv6hdr)) > 65535)
-		return -EMSGSIZE;
-
 	if (msg->msg_controllen) {
 		opt = &opt_space;
 		memset(opt, 0, sizeof(struct ipv6_options));
@@ -592,14 +598,9 @@
 
 static void rawv6_close(struct sock *sk, unsigned long timeout)
 {
-	struct ipv6_pinfo *np = &sk->net_pinfo.af_inet6;
-
 	sk->state = TCP_CLOSE;
-
-	if (np->dst)
-		dst_release(np->dst);
-
 	ipv6_sock_mc_close(sk);
+	sk->dead = 1;
 	destroy_sock(sk);
 }
 

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