patch-2.4.5 linux/net/ipv6/protocol.c

Next file: linux/net/ipv6/route.c
Previous file: linux/net/ipv6/netfilter/ip6_tables.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.4/linux/net/ipv6/protocol.c linux/net/ipv6/protocol.c
@@ -5,7 +5,7 @@
  *
  *		PF_INET6 protocol dispatch tables.
  *
- * Version:	$Id: protocol.c,v 1.9 2000/10/03 07:29:01 anton Exp $
+ * Version:	$Id: protocol.c,v 1.10 2001/05/18 02:25:49 davem Exp $
  *
  * Authors:	Pedro Roque	<roque@di.fc.ul.pt>
  *
@@ -15,6 +15,14 @@
  *		2 of the License, or (at your option) any later version.
  */
 
+/*
+ *      Changes:
+ *
+ *      Vince Laviano (vince@cs.stanford.edu)       16 May 2001
+ *      - Removed unused variable 'inet6_protocol_base'
+ *      - Modified inet6_del_protocol() to correctly maintain copy bit.
+ */
+
 #include <linux/errno.h>
 #include <linux/types.h>
 #include <linux/socket.h>
@@ -32,7 +40,6 @@
 #include <net/ipv6.h>
 #include <net/protocol.h>
 
-struct inet6_protocol *inet6_protocol_base;
 struct inet6_protocol *inet6_protos[MAX_INET_PROTOS];
 
 void inet6_add_protocol(struct inet6_protocol *prot)
@@ -80,6 +87,10 @@
 	}
 
 	p = (struct inet6_protocol *) inet6_protos[hash];
+
+        if (p != NULL && p->protocol == prot->protocol)
+                lp = p;
+
 	while(p != NULL) {
 		/*
 		 * We have to worry if the protocol being deleted is
@@ -91,14 +102,14 @@
 			 * if we are the last one with this protocol and
 			 * there is a previous one, reset its copy bit.
 			 */
-			if (p->copy == 0 && lp != NULL) 
+			if (prot->copy == 0 && lp != NULL)
 				lp->copy = 0;
 			p->next = prot->next;
 			br_write_unlock_bh(BR_NETPROTO_LOCK);
 			return(0);
 		}
 		if (p->next != NULL && p->next->protocol == prot->protocol) 
-			lp = p;
+			lp = p->next;
 
 		p = (struct inet6_protocol *) p->next;
 	}

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