linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table
@ 2001-06-05 16:59 ` La Monte H.P. Yarroll
  2001-06-06 22:07   ` La Monte H.P. Yarroll
                     ` (2 more replies)
  0 siblings, 3 replies; 51+ messages in thread
From: La Monte H.P. Yarroll @ 2001-06-05 16:59 UTC (permalink / raw)
  To: davem; +Cc: linux-kernel, sctp-developers-list

Here is the register/unregister inet[6]_create() table patch revised
for 2.4.5.  We thank Dave Miller for his helpful feedback on earlier
versions of this patch.

DESCRIPTION
This patch adds a mechanism for registering new IP transport protocols
for the socket() system call.  It replaces the hard-coded switch
tables in inet_create() and inet6_create() with explicit data
structures.

The new calls are:
void    inet_register_protosw(struct inet_protosw *p);
void    inet_unregister_protosw(struct inet_protosw *p);
void    inet6_register_protosw(struct inet_protosw *p);
void    inet6_unregister_protosw(struct inet_protosw *p);

This is the first of a series of proposed changes to support IP
transport modules.

MOTIVATION
As part of the effort to create the Linux Kernel implementation of
SCTP <www.sourceforge.net/projects/lksctp>, we seek to make it
possible to load a new IP transport protocol as a kernel module.

It is already possible to register new address families.  It is even
possible to register new transport protocols with IP.  However, in
order to be able to open a socket with a new transport protocol, you
must replace the whole AF_INET address family.

In addition to SCTP, there are other protocols which could find it
useful to be in a kernel module. For example, TCP extensions like TCP
framing and TCP over satellite, multicast protocols, and RTP/ROHC
(robust header compression). In general, support for IP transport
modules makes transport layer experimentation easier.

CHANGES SINCE sockreg2.4.3-04
We noticed that inet6_protocol_base went away in 2.4.5, so we changed
our v6 initialization to parallel the inet6_protocol initialization.
We now call inet6_register_protosw() from *v6_init() instead of having
a static array of struct protosw's.  Since other protocols depend on
raw sockets (e.g. ICMP, IGMP, NDISC) we still register rawv6_protosw
in inet6_init().

piggy (La Monte H.P. Yarroll)
Karl O. Knutson

PATCH FOLLOWS
diff -u -r linux-2.4.5/include/asm-alpha/socket.h linux/include/asm-alpha/socket.h
--- linux-2.4.5/include/asm-alpha/socket.h	Sat Feb  3 13:26:44 2001
+++ linux/include/asm-alpha/socket.h	Mon Jun  4 11:11:30 2001
@@ -66,6 +66,7 @@
 					/* level.  For writing rarp and	*/
 					/* other similar things on the	*/
 					/* user level.			*/
+#define	SOCK_MAX	(SOCK_PACKET+1)
 #endif
 
 #endif /* _ASM_SOCKET_H */
diff -u -r linux-2.4.5/include/asm-arm/socket.h linux/include/asm-arm/socket.h
--- linux-2.4.5/include/asm-arm/socket.h	Sat Feb  3 13:26:44 2001
+++ linux/include/asm-arm/socket.h	Mon Jun  4 11:11:30 2001
@@ -58,6 +58,7 @@
 					/* level.  For writing rarp and	*/
 					/* other similar things on the	*/
 					/* user level.			*/
+#define	SOCK_MAX	(SOCK_PACKET+1)
 #endif
 
 #endif /* _ASM_SOCKET_H */
diff -u -r linux-2.4.5/include/asm-cris/socket.h linux/include/asm-cris/socket.h
--- linux-2.4.5/include/asm-cris/socket.h	Fri Apr  6 12:51:19 2001
+++ linux/include/asm-cris/socket.h	Mon Jun  4 11:11:30 2001
@@ -59,6 +59,7 @@
                                         /* level.  For writing rarp and */
                                         /* other similar things on the  */
                                         /* user level.                  */
+#define	SOCK_MAX	(SOCK_PACKET+1)
 #endif
 
 #endif /* _ASM_SOCKET_H */
diff -u -r linux-2.4.5/include/asm-i386/socket.h linux/include/asm-i386/socket.h
--- linux-2.4.5/include/asm-i386/socket.h	Sat Feb  3 13:26:44 2001
+++ linux/include/asm-i386/socket.h	Mon Jun  4 11:11:30 2001
@@ -58,6 +58,7 @@
 					/* level.  For writing rarp and	*/
 					/* other similar things on the	*/
 					/* user level.			*/
+#define	SOCK_MAX	(SOCK_PACKET+1)
 #endif
 
 #endif /* _ASM_SOCKET_H */
diff -u -r linux-2.4.5/include/asm-ia64/socket.h linux/include/asm-ia64/socket.h
--- linux-2.4.5/include/asm-ia64/socket.h	Sat Feb  3 13:26:44 2001
+++ linux/include/asm-ia64/socket.h	Mon Jun  4 11:11:30 2001
@@ -65,6 +65,7 @@
 					/* level.  For writing rarp and	*/
 					/* other similar things on the	*/
 					/* user level.			*/
+#define	SOCK_MAX	(SOCK_PACKET+1)
 #endif
 
 #endif /* _ASM_IA64_SOCKET_H */
diff -u -r linux-2.4.5/include/asm-m68k/socket.h linux/include/asm-m68k/socket.h
--- linux-2.4.5/include/asm-m68k/socket.h	Sat Feb  3 13:26:44 2001
+++ linux/include/asm-m68k/socket.h	Mon Jun  4 11:11:30 2001
@@ -58,6 +58,7 @@
 					/* level.  For writing rarp and	*/
 					/* other similar things on the	*/
 					/* user level.			*/
+#define	SOCK_MAX	(SOCK_PACKET+1)
 #endif
 
 #endif /* _ASM_SOCKET_H */
diff -u -r linux-2.4.5/include/asm-mips/socket.h linux/include/asm-mips/socket.h
--- linux-2.4.5/include/asm-mips/socket.h	Sat Feb  3 13:26:44 2001
+++ linux/include/asm-mips/socket.h	Mon Jun  4 11:11:30 2001
@@ -71,6 +71,7 @@
 					/* level.  For writing rarp and	*/
 					/* other similar things on the	*/
 					/* user level.			*/
+#define	SOCK_MAX	(SOCK_PACKET+1)
 #endif
 
 #endif /* _ASM_SOCKET_H */
diff -u -r linux-2.4.5/include/asm-mips64/socket.h linux/include/asm-mips64/socket.h
--- linux-2.4.5/include/asm-mips64/socket.h	Sat Feb  3 13:26:44 2001
+++ linux/include/asm-mips64/socket.h	Mon Jun  4 11:11:30 2001
@@ -79,6 +79,7 @@
 					/* level.  For writing rarp and	*/
 					/* other similar things on the	*/
 					/* user level.			*/
+#define	SOCK_MAX	(SOCK_PACKET+1)
 #endif
 
 #endif /* _ASM_SOCKET_H */
diff -u -r linux-2.4.5/include/asm-parisc/socket.h linux/include/asm-parisc/socket.h
--- linux-2.4.5/include/asm-parisc/socket.h	Sat Feb  3 13:26:44 2001
+++ linux/include/asm-parisc/socket.h	Mon Jun  4 11:11:30 2001
@@ -56,6 +56,7 @@
 				/* level.  For writing rarp and	*/
 				/* other similar things on the	*/
 				/* user level.			*/
+#define	SOCK_MAX	(SOCK_PACKET+1)
 #endif
 
 #endif /* _ASM_SOCKET_H */
diff -u -r linux-2.4.5/include/asm-ppc/socket.h linux/include/asm-ppc/socket.h
--- linux-2.4.5/include/asm-ppc/socket.h	Mon May 21 17:02:06 2001
+++ linux/include/asm-ppc/socket.h	Mon Jun  4 11:11:30 2001
@@ -67,6 +67,7 @@
 					/* level.  For writing rarp and	*/
 					/* other similar things on the	*/
 					/* user level.			*/
+#define	SOCK_MAX	(SOCK_PACKET+1)
 #endif
 
 #endif /* _ASM_SOCKET_H */
diff -u -r linux-2.4.5/include/asm-s390/socket.h linux/include/asm-s390/socket.h
--- linux-2.4.5/include/asm-s390/socket.h	Sat Feb  3 13:26:44 2001
+++ linux/include/asm-s390/socket.h	Mon Jun  4 11:11:30 2001
@@ -66,6 +66,7 @@
 					/* level.  For writing rarp and	*/
 					/* other similar things on the	*/
 					/* user level.			*/
+#define	SOCK_MAX	(SOCK_PACKET+1)
 #endif
 
 #endif /* _ASM_SOCKET_H */
diff -u -r linux-2.4.5/include/asm-s390x/socket.h linux/include/asm-s390x/socket.h
--- linux-2.4.5/include/asm-s390x/socket.h	Fri Mar  2 13:12:06 2001
+++ linux/include/asm-s390x/socket.h	Mon Jun  4 11:11:30 2001
@@ -65,6 +65,7 @@
 					/* level.  For writing rarp and	*/
 					/* other similar things on the	*/
 					/* user level.			*/
+#define	SOCK_MAX	(SOCK_PACKET+1)
 #endif
 
 #endif /* _ASM_SOCKET_H */
diff -u -r linux-2.4.5/include/asm-sh/socket.h linux/include/asm-sh/socket.h
--- linux-2.4.5/include/asm-sh/socket.h	Sat Feb  3 13:26:44 2001
+++ linux/include/asm-sh/socket.h	Mon Jun  4 11:11:30 2001
@@ -58,6 +58,7 @@
 					/* level.  For writing rarp and	*/
 					/* other similar things on the	*/
 					/* user level.			*/
+#define	SOCK_MAX	(SOCK_PACKET+1)
 #endif
 
 #endif /* __ASM_SH_SOCKET_H */
diff -u -r linux-2.4.5/include/asm-sparc/socket.h linux/include/asm-sparc/socket.h
--- linux-2.4.5/include/asm-sparc/socket.h	Sat Feb  3 13:26:44 2001
+++ linux/include/asm-sparc/socket.h	Mon Jun  4 11:11:30 2001
@@ -63,6 +63,7 @@
 					/* level.  For writing rarp and	*/
 					/* other similar things on the	*/
 					/* user level.			*/
+#define	SOCK_MAX	(SOCK_PACKET+1)
 #endif
 
 #endif /* _ASM_SOCKET_H */
diff -u -r linux-2.4.5/include/asm-sparc64/socket.h linux/include/asm-sparc64/socket.h
--- linux-2.4.5/include/asm-sparc64/socket.h	Sat Feb  3 13:26:44 2001
+++ linux/include/asm-sparc64/socket.h	Mon Jun  4 11:11:30 2001
@@ -63,6 +63,7 @@
 					/* level.  For writing rarp and	*/
 					/* other similar things on the	*/
 					/* user level.			*/
+#define	SOCK_MAX	(SOCK_PACKET+1)
 #endif
 
 #endif /* _ASM_SOCKET_H */
diff -u -r linux-2.4.5/include/net/protocol.h linux/include/net/protocol.h
--- linux-2.4.5/include/net/protocol.h	Fri May 25 20:01:27 2001
+++ linux/include/net/protocol.h	Mon Jun  4 18:28:00 2001
@@ -63,19 +63,45 @@
 
 #endif
 
+/* This is used to register socket interfaces for IP protocols.  */
+struct inet_protosw {
+	struct list_head list;
+
+        /* These two fields form the lookup key.  */
+	unsigned short	 type;	   /* This is the 2nd argument to socket(2). */
+	int		 protocol; /* This is the L4 protocol number.  */
+
+	struct proto	 *prot;
+	struct proto_ops *ops;
+  
+	char             no_check;   /* checksum on rcv/xmit/none? */
+	unsigned char	 reuse;	     /* Are ports automatically reusable? */
+	int              capability; /* Which (if any) capability do
+				      * we need to use this socket
+				      * interface?
+				      */
+};
+
+
 extern struct inet_protocol *inet_protocol_base;
 extern struct inet_protocol *inet_protos[MAX_INET_PROTOS];
+extern struct list_head inetsw[SOCK_MAX];
 
 #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
 extern struct inet6_protocol *inet6_protos[MAX_INET_PROTOS];
+extern struct list_head inetsw6[SOCK_MAX];
 #endif
 
 extern void	inet_add_protocol(struct inet_protocol *prot);
 extern int	inet_del_protocol(struct inet_protocol *prot);
+extern void	inet_register_protosw(struct inet_protosw *p);
+extern void	inet_unregister_protosw(struct inet_protosw *p);
 
 #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
 extern void	inet6_add_protocol(struct inet6_protocol *prot);
 extern int	inet6_del_protocol(struct inet6_protocol *prot);
+extern void	inet6_register_protosw(struct inet_protosw *p);
+extern void	inet6_unregister_protosw(struct inet_protosw *p);
 #endif
 
 #endif	/* _PROTOCOL_H */
diff -u -r linux-2.4.5/net/ipv4/af_inet.c linux/net/ipv4/af_inet.c
--- linux-2.4.5/net/ipv4/af_inet.c	Tue May  1 22:59:24 2001
+++ linux/net/ipv4/af_inet.c	Mon Jun  4 11:16:27 2001
@@ -14,6 +14,8 @@
  *
  * Changes (see also sock.c)
  *
+ *		piggy,
+ *		Karl Knutson	:	Socket protocol table
  *		A.N.Kuznetsov	:	Socket death error in accept().
  *		John Richardson :	Fix non blocking error in connect()
  *					so sockets that fail to connect
@@ -88,6 +90,7 @@
 #include <linux/smp_lock.h>
 #include <linux/inet.h>
 #include <linux/netdevice.h>
+#include <linux/brlock.h>
 #include <net/ip.h>
 #include <net/protocol.h>
 #include <net/arp.h>
@@ -142,6 +145,11 @@
 int (*br_ioctl_hook)(unsigned long);
 #endif
 
+/* The inetsw table contains everything that inet_create needs to
+ * build a new socket.
+ */
+struct list_head inetsw[SOCK_MAX];
+
 /* New destruction routine */
 
 void inet_sock_destruct(struct sock *sk)
@@ -309,46 +317,56 @@
 static int inet_create(struct socket *sock, int protocol)
 {
 	struct sock *sk;
-	struct proto *prot;
+        struct list_head *p;
+        struct inet_protosw *answer;
 
 	sock->state = SS_UNCONNECTED;
 	sk = sk_alloc(PF_INET, GFP_KERNEL, 1);
 	if (sk == NULL) 
 		goto do_oom;
-
-	switch (sock->type) {
-	case SOCK_STREAM:
-		if (protocol && protocol != IPPROTO_TCP)
-			goto free_and_noproto;
-		protocol = IPPROTO_TCP;
-		prot = &tcp_prot;
-		sock->ops = &inet_stream_ops;
-		break;
-	case SOCK_SEQPACKET:
-		goto free_and_badtype;
-	case SOCK_DGRAM:
-		if (protocol && protocol != IPPROTO_UDP)
-			goto free_and_noproto;
-		protocol = IPPROTO_UDP;
-		sk->no_check = UDP_CSUM_DEFAULT;
-		prot=&udp_prot;
-		sock->ops = &inet_dgram_ops;
-		break;
-	case SOCK_RAW:
-		if (!capable(CAP_NET_RAW))
-			goto free_and_badperm;
-		if (!protocol)
-			goto free_and_noproto;
-		prot = &raw_prot;
-		sk->reuse = 1;
-		sk->num = protocol;
-		sock->ops = &inet_dgram_ops;
-		if (protocol == IPPROTO_RAW)
-			sk->protinfo.af_inet.hdrincl = 1;
-		break;
-	default:
-		goto free_and_badtype;
-	}
+  
+        /* Look for the requested type/protocol pair.  */
+        answer = NULL;
+  	br_read_lock_bh(BR_NETPROTO_LOCK);
+        list_for_each(p, &inetsw[sock->type]) {
+                answer = list_entry(p, struct inet_protosw, list);
+                /* Check the non-wild match.  */
+                if (protocol == answer->protocol) {
+                        if (protocol != IPPROTO_IP) {
+                                break;
+                        }
+                } else {
+                        /* Check for the two wild cases. */
+                        if (IPPROTO_IP == protocol) {
+                                protocol = answer->protocol;
+                                break;
+                        }
+                        if (IPPROTO_IP == answer->protocol) {
+                                break;
+                        }
+                }
+                answer = NULL;
+        }
+  	br_read_unlock_bh(BR_NETPROTO_LOCK);
+
+        if (!answer)
+                goto free_and_badtype;
+        if (answer->capability > 0 && !capable(answer->capability))
+                goto free_and_badperm;
+        if (!protocol)
+                goto free_and_noproto;
+
+        sock->ops = answer->ops;
+        sk->prot = answer->prot;
+        sk->no_check = answer->no_check;
+        if (answer->reuse)
+                sk->reuse = answer->reuse;
+
+        if (SOCK_RAW == sock->type) {
+                sk->num = protocol;
+                if (IPPROTO_RAW == protocol)
+                        sk->protinfo.af_inet.hdrincl = 1;
+        }
 
 	if (ipv4_config.no_pmtu_disc)
 		sk->protinfo.af_inet.pmtudisc = IP_PMTUDISC_DONT;
@@ -365,8 +383,7 @@
 	sk->family	= PF_INET;
 	sk->protocol	= protocol;
 
-	sk->prot	= prot;
-	sk->backlog_rcv = prot->backlog_rcv;
+	sk->backlog_rcv = sk->prot->backlog_rcv;
 
 	sk->protinfo.af_inet.ttl	= sysctl_ip_default_ttl;
 
@@ -969,6 +986,70 @@
 extern void tcp_init(void);
 extern void tcp_v4_init(struct net_proto_family *);
 
+/* Upon startup we insert all the elements in inetsw_array[] into
+ * the linked list inetsw.
+ */
+static struct inet_protosw inetsw_array[] =
+{
+        {
+                type:        SOCK_STREAM,
+                protocol:    IPPROTO_TCP,
+                prot:        &tcp_prot,
+                ops:         &inet_stream_ops,
+                no_check:     0,
+                reuse:        0,
+                capability:  -1,
+        },
+
+        {
+                type:        SOCK_DGRAM,
+                protocol:    IPPROTO_UDP,
+                prot:        &udp_prot,
+                ops:         &inet_dgram_ops,
+                no_check:    UDP_CSUM_DEFAULT,
+                reuse:       0,
+                capability:  -1,
+       },
+        
+
+       {
+               type:        SOCK_RAW,
+               protocol:    IPPROTO_IP,	/* wild card */
+               prot:        &raw_prot,
+               ops:         &inet_dgram_ops,
+               no_check:    UDP_CSUM_DEFAULT,
+               reuse:       1,
+               capability:  CAP_NET_RAW,
+       }
+}; /* struct inet_protosw inetsw_array[] */
+
+#define INETSW_ARRAY_LEN (sizeof(inetsw_array) / sizeof(struct inet_protosw))
+
+void
+inet_register_protosw(struct inet_protosw *p)
+{
+	/* Add to the BEGINNING so that we override any existing
+	 * entry.  This means that when we remove this entry, the
+	 * system automatically returns to the old behavior.
+	 */
+        if (p->type < SOCK_MAX) {
+                br_write_lock_bh(BR_NETPROTO_LOCK);
+                list_add(&p->list, &inetsw[p->type]);
+                br_write_unlock_bh(BR_NETPROTO_LOCK);
+        } else {
+                printk(KERN_DEBUG "Ignoring attempt to register illegal socket type %d.\n",
+                       p->type);
+        }
+} /* inet_protosw_register() */
+
+void
+inet_unregister_protosw(struct inet_protosw *p)
+{
+        br_write_lock_bh(BR_NETPROTO_LOCK);
+	list_del(&p->list);
+  	br_write_unlock_bh(BR_NETPROTO_LOCK);
+} /* inet_protosw_unregister() */
+
 
 /*
  *	Called by socket.c on kernel startup.  
@@ -978,6 +1059,8 @@
 {
 	struct sk_buff *dummy_skb;
 	struct inet_protocol *p;
+	struct inet_protosw *q;
+        struct list_head *r;
 
 	printk(KERN_INFO "NET4: Linux TCP/IP 1.0 for NET4.0\n");
 
@@ -1003,6 +1086,14 @@
 		printk("%s%s",p->name,tmp?", ":"\n");
 		p = tmp;
 	}
+
+        /* Register the socket-side information for inet_create.  */
+        for(r = &inetsw[0]; r < &inetsw[SOCK_MAX]; ++r) {
+                INIT_LIST_HEAD(r);
+        }
+        for(q = inetsw_array; q < &inetsw_array[INETSW_ARRAY_LEN]; ++q) {
+                inet_register_protosw(q);
+        }
 
 	/*
 	 *	Set the ARP module up
diff -u -r linux-2.4.5/net/ipv6/af_inet6.c linux/net/ipv6/af_inet6.c
--- linux-2.4.5/net/ipv6/af_inet6.c	Thu Apr 12 14:11:39 2001
+++ linux/net/ipv6/af_inet6.c	Mon Jun  4 18:39:53 2001
@@ -10,6 +10,7 @@
  *	$Id: af_inet6.c,v 1.63 2001/03/02 03:13:05 davem Exp $
  *
  * 	Fixes:
+ *	piggy, Karl Knutson	:	Socket protocol table
  * 	Hideaki YOSHIFUJI	:	sin6_scope_id support
  * 	Arnaldo Melo		: 	check proc_net_create return, cleanups
  *
@@ -44,6 +45,7 @@
 #include <linux/inet.h>
 #include <linux/netdevice.h>
 #include <linux/icmpv6.h>
+#include <linux/brlock.h>
 #include <linux/smp_lock.h>
 
 #include <net/ip.h>
@@ -71,9 +73,6 @@
 MODULE_PARM(unloadable, "i");
 #endif
 
-extern struct proto_ops inet6_stream_ops;
-extern struct proto_ops inet6_dgram_ops;
-
 /* IPv6 procfs goodies... */
 
 #ifdef CONFIG_PROC_FS
@@ -93,6 +92,11 @@
 atomic_t inet6_sock_nr;
 #endif
 
+/* The inetsw table contains everything that inet_create needs to
+ * build a new socket.
+ */
+struct list_head inetsw6[SOCK_MAX];
+
 static void inet6_sock_destruct(struct sock *sk)
 {
 	inet_sock_destruct(sk);
@@ -106,47 +110,64 @@
 static int inet6_create(struct socket *sock, int protocol)
 {
 	struct sock *sk;
-	struct proto *prot;
+        struct list_head *p;
+        struct inet_protosw *answer;
 
 	sk = sk_alloc(PF_INET6, GFP_KERNEL, 1);
 	if (sk == NULL) 
 		goto do_oom;
 
-	if(sock->type == SOCK_STREAM || sock->type == SOCK_SEQPACKET) {
-		if (protocol && protocol != IPPROTO_TCP) 
-			goto free_and_noproto;
-		protocol = IPPROTO_TCP;
-		prot = &tcpv6_prot;
-		sock->ops = &inet6_stream_ops;
-	} else if(sock->type == SOCK_DGRAM) {
-		if (protocol && protocol != IPPROTO_UDP) 
-			goto free_and_noproto;
-		protocol = IPPROTO_UDP;
-		sk->no_check = UDP_CSUM_DEFAULT;
-		prot=&udpv6_prot;
-		sock->ops = &inet6_dgram_ops;
-	} else if(sock->type == SOCK_RAW) {
-		if (!capable(CAP_NET_RAW))
-			goto free_and_badperm;
-		if (!protocol) 
-			goto free_and_noproto;
-		prot = &rawv6_prot;
-		sock->ops = &inet6_dgram_ops;
-		sk->reuse = 1;
-		sk->num = protocol;
-	} else {
-		goto free_and_badtype;
-	}
-	
+        /* Look for the requested type/protocol pair.  */
+        answer = NULL;
+	br_read_lock_bh(BR_NETPROTO_LOCK);
+        list_for_each(p, &inetsw6[sock->type]) {
+                answer = list_entry(p, struct inet_protosw, list);
+                /* Check the non-wild match.  */
+                if (protocol == answer->protocol) {
+                        if (protocol != IPPROTO_IP) {
+                                break;
+                        }
+                } else {
+                        /* Check for the two wild cases. */
+                        if (IPPROTO_IP == protocol) {
+                                protocol = answer->protocol;
+                                break;
+                        }
+                        if (IPPROTO_IP == answer->protocol) {
+                                break;
+                        }
+                }
+                answer = NULL;
+        }
+	br_read_unlock_bh(BR_NETPROTO_LOCK);
+
+        if (!answer)
+                goto free_and_badtype;
+        if (answer->capability > 0 && !capable(answer->capability))
+                goto free_and_badperm;
+        if (!protocol)
+                goto free_and_noproto;
+
+        sock->ops = answer->ops;
 	sock_init_data(sock, sk);
 
+	sk->prot		= answer->prot;
+        sk->no_check = answer->no_check;
+        if (answer->reuse)
+                sk->reuse = answer->reuse;
+
+        if (SOCK_RAW == sock->type) {
+                sk->num = protocol;
+                if (IPPROTO_RAW == protocol)
+                        sk->protinfo.af_inet.hdrincl = 1;
+        }
+
 	sk->destruct            = inet6_sock_destruct;
 	sk->zapped		= 0;
 	sk->family		= PF_INET6;
 	sk->protocol		= protocol;
 
-	sk->prot		= prot;
-	sk->backlog_rcv		= prot->backlog_rcv;
+	sk->backlog_rcv		= answer->prot->backlog_rcv;
 
 	sk->net_pinfo.af_inet6.hop_limit  = -1;
 	sk->net_pinfo.af_inet6.mcast_hops = -1;
@@ -175,9 +196,6 @@
 #endif
 	MOD_INC_USE_COUNT;
 
-	if (sk->type==SOCK_RAW && protocol==IPPROTO_RAW)
-		sk->protinfo.af_inet.hdrincl=1;
-
 	if (sk->num) {
 		/* It assumes that any protocol which allows
 		 * the user to assign a number at socket
@@ -186,7 +204,6 @@
 		sk->sport = ntohs(sk->num);
 		sk->prot->hash(sk);
 	}
-
 	if (sk->prot->init) {
 		int err = sk->prot->init(sk);
 		if (err != 0) {
@@ -504,9 +521,47 @@
 extern void ipv6_sysctl_unregister(void);
 #endif
 
+static struct inet_protosw rawv6_protosw = {
+        type:        SOCK_RAW,
+        protocol:    IPPROTO_IP,	/* wild card */
+        prot:        &rawv6_prot,
+        ops:         &inet6_dgram_ops,
+        no_check:    UDP_CSUM_DEFAULT,
+        reuse:       1,
+        capability:  CAP_NET_RAW,
+};
+
+#define INETSW6_ARRAY_LEN (sizeof(inetsw6_array) / sizeof(struct inet_protosw))
+
+void
+inet6_register_protosw(struct inet_protosw *p)
+{
+	/* Add to the BEGINNING so that we override any existing
+	 * entry.  This means that when we remove this entry, the
+	 * system automatically returns to the old behavior.
+	 */
+        if (p->type < SOCK_MAX) {
+                br_write_lock_bh(BR_NETPROTO_LOCK);
+                list_add(&p->list, &inetsw6[p->type]);
+                br_write_unlock_bh(BR_NETPROTO_LOCK);
+        } else {
+                printk(KERN_DEBUG "Ignoring attempt to register illegal socket type %d.\n",
+                       p->type);
+        }
+} /* inet_protosw_register() */
+
+void
+inet6_unregister_protosw(struct inet_protosw *p)
+{
+        br_write_lock_bh(BR_NETPROTO_LOCK);
+	list_del(&p->list);
+        br_write_unlock_bh(BR_NETPROTO_LOCK);
+} /* inet_protosw_unregister() */
+
 static int __init inet6_init(void)
 {
 	struct sk_buff *dummy_skb;
+        struct list_head *r;
 	int err;
 
 #ifdef MODULE
@@ -523,6 +578,16 @@
 		printk(KERN_CRIT "inet6_proto_init: size fault\n");
 		return -EINVAL;
 	}
+
+        /* Register the socket-side information for inet6_create.  */
+        for(r = &inetsw6[0]; r < &inetsw6[SOCK_MAX]; ++r) {
+                INIT_LIST_HEAD(r);
+        }
+
+        /* We MUST register RAW sockets before we create the ICMP6,
+         * IGMP6, or NDISC control sockets.
+         */
+        inet6_register_protosw(&rawv6_protosw);
 
 	/*
 	 *	ipngwg API draft makes clear that the correct semantics
diff -u -r linux-2.4.5/net/ipv6/tcp_ipv6.c linux/net/ipv6/tcp_ipv6.c
--- linux-2.4.5/net/ipv6/tcp_ipv6.c	Wed Apr 25 16:57:39 2001
+++ linux/net/ipv6/tcp_ipv6.c	Mon Jun  4 18:35:31 2001
@@ -2125,8 +2125,21 @@
 	"TCPv6"			/* name			*/
 };
 
+extern struct proto_ops inet6_stream_ops;
+
+static struct inet_protosw tcpv6_protosw = {
+        type:        SOCK_STREAM,
+        protocol:    IPPROTO_TCP,
+        prot:        &tcpv6_prot,
+        ops:         &inet6_stream_ops,
+        no_check:     0,
+        reuse:        0,
+        capability:  -1,
+};
+
 void __init tcpv6_init(void)
 {
 	/* register inet6 protocol */
 	inet6_add_protocol(&tcpv6_protocol);
+        inet6_register_protosw(&tcpv6_protosw);
 }
diff -u -r linux-2.4.5/net/ipv6/udp.c linux/net/ipv6/udp.c
--- linux-2.4.5/net/ipv6/udp.c	Thu Apr 12 14:11:39 2001
+++ linux/net/ipv6/udp.c	Mon Jun  4 18:36:03 2001
@@ -992,7 +992,21 @@
 	get_port:	udp_v6_get_port,
 };
 
+extern struct proto_ops inet6_dgram_ops;
+
+static struct inet_protosw udpv6_protosw = {
+        type:        SOCK_DGRAM,
+        protocol:    IPPROTO_UDP,
+        prot:        &udpv6_prot,
+        ops:         &inet6_dgram_ops,
+        no_check:    UDP_CSUM_DEFAULT,
+        reuse:        0,
+        capability:  -1,
+};
+
+
 void __init udpv6_init(void)
 {
 	inet6_add_protocol(&udpv6_protocol);
+        inet6_register_protosw(&udpv6_protosw);
 }
diff -u -r linux-2.4.5/net/netsyms.c linux/net/netsyms.c
--- linux-2.4.5/net/netsyms.c	Fri Apr 27 16:15:01 2001
+++ linux/net/netsyms.c	Mon Jun  4 11:11:30 2001
@@ -234,6 +234,8 @@
 EXPORT_SYMBOL(inetdev_lock);
 EXPORT_SYMBOL(inet_add_protocol);
 EXPORT_SYMBOL(inet_del_protocol);
+EXPORT_SYMBOL(inet_register_protosw);
+EXPORT_SYMBOL(inet_unregister_protosw);
 EXPORT_SYMBOL(ip_route_output_key);
 EXPORT_SYMBOL(ip_route_input);
 EXPORT_SYMBOL(icmp_send);

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table
  2001-06-05 16:59 ` [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table La Monte H.P. Yarroll
@ 2001-06-06 22:07   ` La Monte H.P. Yarroll
  2001-06-07 19:11     ` Matthias Urlichs
  2001-06-11 18:26   ` [PATCH] sockreg2.4.5-06 " La Monte H.P. Yarroll
  2001-06-13 16:25   ` David S. Miller
  2 siblings, 1 reply; 51+ messages in thread
From: La Monte H.P. Yarroll @ 2001-06-06 22:07 UTC (permalink / raw)
  To: Matt D. Robinson; +Cc: linux-kernel, sctp-developers-list

Thanks!  I'm glad you like our code.

This patch does allow you to override TCP with a new implementation
for new connections and then back out safely to the old TCP later.

I think the feature you are asking for (replace TCP for EXISTING
connections) is quite dangerous.  You COULD grub around in existing
sock structures and replace the proto_ops, but that would not be
enough.  We are talking about a stateful protocol here--your "TCP2"
module would have to safely extract the state of the existing TCP
connections and replace the control functions all as an atomic
operation...and then undo that at the end.

What was the application you had in mind?  The applications we have
been playing with do not suffer greatly from having to start new
connections.

Matt D. Robinson writes:
 > Is there any way to add in the capability to _replace_ TCP with
 > your own, so you can use your own layer?  I guess you could
 > inet_unregister_protosw() of the IPPROTO_TCP, but does that
 > address outstanding connections?  I don't believe so ...
 > 
 > It would be nice if your patch offered that capability.  Nice
 > work, BTW -- not enough compliments go out on lkml these days. :)
 > 
 > --Matt
 > 
 > "La Monte H.P. Yarroll" wrote:
 > > 
 > > Here is the register/unregister inet[6]_create() table patch revised
 > > for 2.4.5.  We thank Dave Miller for his helpful feedback on earlier
 > > versions of this patch.
 > > 
 > > DESCRIPTION
 > > This patch adds a mechanism for registering new IP transport protocols
 > > for the socket() system call.  It replaces the hard-coded switch
 > > tables in inet_create() and inet6_create() with explicit data
 > > structures.
 > > 
 > > The new calls are:
 > > void    inet_register_protosw(struct inet_protosw *p);
 > > void    inet_unregister_protosw(struct inet_protosw *p);
 > > void    inet6_register_protosw(struct inet_protosw *p);
 > > void    inet6_unregister_protosw(struct inet_protosw *p);
 > > 
 > > This is the first of a series of proposed changes to support IP
 > > transport modules.
 > > 
 > > MOTIVATION
 > > As part of the effort to create the Linux Kernel implementation of
 > > SCTP <www.sourceforge.net/projects/lksctp>, we seek to make it
 > > possible to load a new IP transport protocol as a kernel module.
 > > 
 > > It is already possible to register new address families.  It is even
 > > possible to register new transport protocols with IP.  However, in
 > > order to be able to open a socket with a new transport protocol, you
 > > must replace the whole AF_INET address family.
 > > 
 > > In addition to SCTP, there are other protocols which could find it
 > > useful to be in a kernel module. For example, TCP extensions like TCP
 > > framing and TCP over satellite, multicast protocols, and RTP/ROHC
 > > (robust header compression). In general, support for IP transport
 > > modules makes transport layer experimentation easier.
 > > 
 > > CHANGES SINCE sockreg2.4.3-04
 > > We noticed that inet6_protocol_base went away in 2.4.5, so we changed
 > > our v6 initialization to parallel the inet6_protocol initialization.
 > > We now call inet6_register_protosw() from *v6_init() instead of having
 > > a static array of struct protosw's.  Since other protocols depend on
 > > raw sockets (e.g. ICMP, IGMP, NDISC) we still register rawv6_protosw
 > > in inet6_init().
 > > 
 > > piggy (La Monte H.P. Yarroll)
 > > Karl O. Knutson
 > > 
 > > PATCH FOLLOWS
 > > diff -u -r linux-2.4.5/include/asm-alpha/socket.h linux/include/asm-alpha/socket.h
 > > --- linux-2.4.5/include/asm-alpha/socket.h      Sat Feb  3 13:26:44 2001
 > > +++ linux/include/asm-alpha/socket.h    Mon Jun  4 11:11:30 2001
 > > @@ -66,6 +66,7 @@
 > >                                         /* level.  For writing rarp and */
 > >                                         /* other similar things on the  */
 > >                                         /* user level.                  */
 > > +#define        SOCK_MAX        (SOCK_PACKET+1)
 > >  #endif
 > > 
 > >  #endif /* _ASM_SOCKET_H */
 > > diff -u -r linux-2.4.5/include/asm-arm/socket.h linux/include/asm-arm/socket.h
 > > --- linux-2.4.5/include/asm-arm/socket.h        Sat Feb  3 13:26:44 2001
 > > +++ linux/include/asm-arm/socket.h      Mon Jun  4 11:11:30 2001
 > > @@ -58,6 +58,7 @@
 > >                                         /* level.  For writing rarp and */
 > >                                         /* other similar things on the  */
 > >                                         /* user level.                  */
 > > +#define        SOCK_MAX        (SOCK_PACKET+1)
 > >  #endif
 > > 
 > >  #endif /* _ASM_SOCKET_H */
 > > diff -u -r linux-2.4.5/include/asm-cris/socket.h linux/include/asm-cris/socket.h
 > > --- linux-2.4.5/include/asm-cris/socket.h       Fri Apr  6 12:51:19 2001
 > > +++ linux/include/asm-cris/socket.h     Mon Jun  4 11:11:30 2001
 > > @@ -59,6 +59,7 @@
 > >                                          /* level.  For writing rarp and */
 > >                                          /* other similar things on the  */
 > >                                          /* user level.                  */
 > > +#define        SOCK_MAX        (SOCK_PACKET+1)
 > >  #endif
 > > 
 > >  #endif /* _ASM_SOCKET_H */
 > > diff -u -r linux-2.4.5/include/asm-i386/socket.h linux/include/asm-i386/socket.h
 > > --- linux-2.4.5/include/asm-i386/socket.h       Sat Feb  3 13:26:44 2001
 > > +++ linux/include/asm-i386/socket.h     Mon Jun  4 11:11:30 2001
 > > @@ -58,6 +58,7 @@
 > >                                         /* level.  For writing rarp and */
 > >                                         /* other similar things on the  */
 > >                                         /* user level.                  */
 > > +#define        SOCK_MAX        (SOCK_PACKET+1)
 > >  #endif
 > > 
 > >  #endif /* _ASM_SOCKET_H */
 > > diff -u -r linux-2.4.5/include/asm-ia64/socket.h linux/include/asm-ia64/socket.h
 > > --- linux-2.4.5/include/asm-ia64/socket.h       Sat Feb  3 13:26:44 2001
 > > +++ linux/include/asm-ia64/socket.h     Mon Jun  4 11:11:30 2001
 > > @@ -65,6 +65,7 @@
 > >                                         /* level.  For writing rarp and */
 > >                                         /* other similar things on the  */
 > >                                         /* user level.                  */
 > > +#define        SOCK_MAX        (SOCK_PACKET+1)
 > >  #endif
 > > 
 > >  #endif /* _ASM_IA64_SOCKET_H */
 > > diff -u -r linux-2.4.5/include/asm-m68k/socket.h linux/include/asm-m68k/socket.h
 > > --- linux-2.4.5/include/asm-m68k/socket.h       Sat Feb  3 13:26:44 2001
 > > +++ linux/include/asm-m68k/socket.h     Mon Jun  4 11:11:30 2001
 > > @@ -58,6 +58,7 @@
 > >                                         /* level.  For writing rarp and */
 > >                                         /* other similar things on the  */
 > >                                         /* user level.                  */
 > > +#define        SOCK_MAX        (SOCK_PACKET+1)
 > >  #endif
 > > 
 > >  #endif /* _ASM_SOCKET_H */
 > > diff -u -r linux-2.4.5/include/asm-mips/socket.h linux/include/asm-mips/socket.h
 > > --- linux-2.4.5/include/asm-mips/socket.h       Sat Feb  3 13:26:44 2001
 > > +++ linux/include/asm-mips/socket.h     Mon Jun  4 11:11:30 2001
 > > @@ -71,6 +71,7 @@
 > >                                         /* level.  For writing rarp and */
 > >                                         /* other similar things on the  */
 > >                                         /* user level.                  */
 > > +#define        SOCK_MAX        (SOCK_PACKET+1)
 > >  #endif
 > > 
 > >  #endif /* _ASM_SOCKET_H */
 > > diff -u -r linux-2.4.5/include/asm-mips64/socket.h linux/include/asm-mips64/socket.h
 > > --- linux-2.4.5/include/asm-mips64/socket.h     Sat Feb  3 13:26:44 2001
 > > +++ linux/include/asm-mips64/socket.h   Mon Jun  4 11:11:30 2001
 > > @@ -79,6 +79,7 @@
 > >                                         /* level.  For writing rarp and */
 > >                                         /* other similar things on the  */
 > >                                         /* user level.                  */
 > > +#define        SOCK_MAX        (SOCK_PACKET+1)
 > >  #endif
 > > 
 > >  #endif /* _ASM_SOCKET_H */
 > > diff -u -r linux-2.4.5/include/asm-parisc/socket.h linux/include/asm-parisc/socket.h
 > > --- linux-2.4.5/include/asm-parisc/socket.h     Sat Feb  3 13:26:44 2001
 > > +++ linux/include/asm-parisc/socket.h   Mon Jun  4 11:11:30 2001
 > > @@ -56,6 +56,7 @@
 > >                                 /* level.  For writing rarp and */
 > >                                 /* other similar things on the  */
 > >                                 /* user level.                  */
 > > +#define        SOCK_MAX        (SOCK_PACKET+1)
 > >  #endif
 > > 
 > >  #endif /* _ASM_SOCKET_H */
 > > diff -u -r linux-2.4.5/include/asm-ppc/socket.h linux/include/asm-ppc/socket.h
 > > --- linux-2.4.5/include/asm-ppc/socket.h        Mon May 21 17:02:06 2001
 > > +++ linux/include/asm-ppc/socket.h      Mon Jun  4 11:11:30 2001
 > > @@ -67,6 +67,7 @@
 > >                                         /* level.  For writing rarp and */
 > >                                         /* other similar things on the  */
 > >                                         /* user level.                  */
 > > +#define        SOCK_MAX        (SOCK_PACKET+1)
 > >  #endif
 > > 
 > >  #endif /* _ASM_SOCKET_H */
 > > diff -u -r linux-2.4.5/include/asm-s390/socket.h linux/include/asm-s390/socket.h
 > > --- linux-2.4.5/include/asm-s390/socket.h       Sat Feb  3 13:26:44 2001
 > > +++ linux/include/asm-s390/socket.h     Mon Jun  4 11:11:30 2001
 > > @@ -66,6 +66,7 @@
 > >                                         /* level.  For writing rarp and */
 > >                                         /* other similar things on the  */
 > >                                         /* user level.                  */
 > > +#define        SOCK_MAX        (SOCK_PACKET+1)
 > >  #endif
 > > 
 > >  #endif /* _ASM_SOCKET_H */
 > > diff -u -r linux-2.4.5/include/asm-s390x/socket.h linux/include/asm-s390x/socket.h
 > > --- linux-2.4.5/include/asm-s390x/socket.h      Fri Mar  2 13:12:06 2001
 > > +++ linux/include/asm-s390x/socket.h    Mon Jun  4 11:11:30 2001
 > > @@ -65,6 +65,7 @@
 > >                                         /* level.  For writing rarp and */
 > >                                         /* other similar things on the  */
 > >                                         /* user level.                  */
 > > +#define        SOCK_MAX        (SOCK_PACKET+1)
 > >  #endif
 > > 
 > >  #endif /* _ASM_SOCKET_H */
 > > diff -u -r linux-2.4.5/include/asm-sh/socket.h linux/include/asm-sh/socket.h
 > > --- linux-2.4.5/include/asm-sh/socket.h Sat Feb  3 13:26:44 2001
 > > +++ linux/include/asm-sh/socket.h       Mon Jun  4 11:11:30 2001
 > > @@ -58,6 +58,7 @@
 > >                                         /* level.  For writing rarp and */
 > >                                         /* other similar things on the  */
 > >                                         /* user level.                  */
 > > +#define        SOCK_MAX        (SOCK_PACKET+1)
 > >  #endif
 > > 
 > >  #endif /* __ASM_SH_SOCKET_H */
 > > diff -u -r linux-2.4.5/include/asm-sparc/socket.h linux/include/asm-sparc/socket.h
 > > --- linux-2.4.5/include/asm-sparc/socket.h      Sat Feb  3 13:26:44 2001
 > > +++ linux/include/asm-sparc/socket.h    Mon Jun  4 11:11:30 2001
 > > @@ -63,6 +63,7 @@
 > >                                         /* level.  For writing rarp and */
 > >                                         /* other similar things on the  */
 > >                                         /* user level.                  */
 > > +#define        SOCK_MAX        (SOCK_PACKET+1)
 > >  #endif
 > > 
 > >  #endif /* _ASM_SOCKET_H */
 > > diff -u -r linux-2.4.5/include/asm-sparc64/socket.h linux/include/asm-sparc64/socket.h
 > > --- linux-2.4.5/include/asm-sparc64/socket.h    Sat Feb  3 13:26:44 2001
 > > +++ linux/include/asm-sparc64/socket.h  Mon Jun  4 11:11:30 2001
 > > @@ -63,6 +63,7 @@
 > >                                         /* level.  For writing rarp and */
 > >                                         /* other similar things on the  */
 > >                                         /* user level.                  */
 > > +#define        SOCK_MAX        (SOCK_PACKET+1)
 > >  #endif
 > > 
 > >  #endif /* _ASM_SOCKET_H */
 > > diff -u -r linux-2.4.5/include/net/protocol.h linux/include/net/protocol.h
 > > --- linux-2.4.5/include/net/protocol.h  Fri May 25 20:01:27 2001
 > > +++ linux/include/net/protocol.h        Mon Jun  4 18:28:00 2001
 > > @@ -63,19 +63,45 @@
 > > 
 > >  #endif
 > > 
 > > +/* This is used to register socket interfaces for IP protocols.  */
 > > +struct inet_protosw {
 > > +       struct list_head list;
 > > +
 > > +        /* These two fields form the lookup key.  */
 > > +       unsigned short   type;     /* This is the 2nd argument to socket(2). */
 > > +       int              protocol; /* This is the L4 protocol number.  */
 > > +
 > > +       struct proto     *prot;
 > > +       struct proto_ops *ops;
 > > +
 > > +       char             no_check;   /* checksum on rcv/xmit/none? */
 > > +       unsigned char    reuse;      /* Are ports automatically reusable? */
 > > +       int              capability; /* Which (if any) capability do
 > > +                                     * we need to use this socket
 > > +                                     * interface?
 > > +                                     */
 > > +};
 > > +
 > > +
 > >  extern struct inet_protocol *inet_protocol_base;
 > >  extern struct inet_protocol *inet_protos[MAX_INET_PROTOS];
 > > +extern struct list_head inetsw[SOCK_MAX];
 > > 
 > >  #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
 > >  extern struct inet6_protocol *inet6_protos[MAX_INET_PROTOS];
 > > +extern struct list_head inetsw6[SOCK_MAX];
 > >  #endif
 > > 
 > >  extern void    inet_add_protocol(struct inet_protocol *prot);
 > >  extern int     inet_del_protocol(struct inet_protocol *prot);
 > > +extern void    inet_register_protosw(struct inet_protosw *p);
 > > +extern void    inet_unregister_protosw(struct inet_protosw *p);
 > > 
 > >  #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
 > >  extern void    inet6_add_protocol(struct inet6_protocol *prot);
 > >  extern int     inet6_del_protocol(struct inet6_protocol *prot);
 > > +extern void    inet6_register_protosw(struct inet_protosw *p);
 > > +extern void    inet6_unregister_protosw(struct inet_protosw *p);
 > >  #endif
 > > 
 > >  #endif /* _PROTOCOL_H */
 > > diff -u -r linux-2.4.5/net/ipv4/af_inet.c linux/net/ipv4/af_inet.c
 > > --- linux-2.4.5/net/ipv4/af_inet.c      Tue May  1 22:59:24 2001
 > > +++ linux/net/ipv4/af_inet.c    Mon Jun  4 11:16:27 2001
 > > @@ -14,6 +14,8 @@
 > >   *
 > >   * Changes (see also sock.c)
 > >   *
 > > + *             piggy,
 > > + *             Karl Knutson    :       Socket protocol table
 > >   *             A.N.Kuznetsov   :       Socket death error in accept().
 > >   *             John Richardson :       Fix non blocking error in connect()
 > >   *                                     so sockets that fail to connect
 > > @@ -88,6 +90,7 @@
 > >  #include <linux/smp_lock.h>
 > >  #include <linux/inet.h>
 > >  #include <linux/netdevice.h>
 > > +#include <linux/brlock.h>
 > >  #include <net/ip.h>
 > >  #include <net/protocol.h>
 > >  #include <net/arp.h>
 > > @@ -142,6 +145,11 @@
 > >  int (*br_ioctl_hook)(unsigned long);
 > >  #endif
 > > 
 > > +/* The inetsw table contains everything that inet_create needs to
 > > + * build a new socket.
 > > + */
 > > +struct list_head inetsw[SOCK_MAX];
 > > +
 > >  /* New destruction routine */
 > > 
 > >  void inet_sock_destruct(struct sock *sk)
 > > @@ -309,46 +317,56 @@
 > >  static int inet_create(struct socket *sock, int protocol)
 > >  {
 > >         struct sock *sk;
 > > -       struct proto *prot;
 > > +        struct list_head *p;
 > > +        struct inet_protosw *answer;
 > > 
 > >         sock->state = SS_UNCONNECTED;
 > >         sk = sk_alloc(PF_INET, GFP_KERNEL, 1);
 > >         if (sk == NULL)
 > >                 goto do_oom;
 > > -
 > > -       switch (sock->type) {
 > > -       case SOCK_STREAM:
 > > -               if (protocol && protocol != IPPROTO_TCP)
 > > -                       goto free_and_noproto;
 > > -               protocol = IPPROTO_TCP;
 > > -               prot = &tcp_prot;
 > > -               sock->ops = &inet_stream_ops;
 > > -               break;
 > > -       case SOCK_SEQPACKET:
 > > -               goto free_and_badtype;
 > > -       case SOCK_DGRAM:
 > > -               if (protocol && protocol != IPPROTO_UDP)
 > > -                       goto free_and_noproto;
 > > -               protocol = IPPROTO_UDP;
 > > -               sk->no_check = UDP_CSUM_DEFAULT;
 > > -               prot=&udp_prot;
 > > -               sock->ops = &inet_dgram_ops;
 > > -               break;
 > > -       case SOCK_RAW:
 > > -               if (!capable(CAP_NET_RAW))
 > > -                       goto free_and_badperm;
 > > -               if (!protocol)
 > > -                       goto free_and_noproto;
 > > -               prot = &raw_prot;
 > > -               sk->reuse = 1;
 > > -               sk->num = protocol;
 > > -               sock->ops = &inet_dgram_ops;
 > > -               if (protocol == IPPROTO_RAW)
 > > -                       sk->protinfo.af_inet.hdrincl = 1;
 > > -               break;
 > > -       default:
 > > -               goto free_and_badtype;
 > > -       }
 > > +
 > > +        /* Look for the requested type/protocol pair.  */
 > > +        answer = NULL;
 > > +       br_read_lock_bh(BR_NETPROTO_LOCK);
 > > +        list_for_each(p, &inetsw[sock->type]) {
 > > +                answer = list_entry(p, struct inet_protosw, list);
 > > +                /* Check the non-wild match.  */
 > > +                if (protocol == answer->protocol) {
 > > +                        if (protocol != IPPROTO_IP) {
 > > +                                break;
 > > +                        }
 > > +                } else {
 > > +                        /* Check for the two wild cases. */
 > > +                        if (IPPROTO_IP == protocol) {
 > > +                                protocol = answer->protocol;
 > > +                                break;
 > > +                        }
 > > +                        if (IPPROTO_IP == answer->protocol) {
 > > +                                break;
 > > +                        }
 > > +                }
 > > +                answer = NULL;
 > > +        }
 > > +       br_read_unlock_bh(BR_NETPROTO_LOCK);
 > > +
 > > +        if (!answer)
 > > +                goto free_and_badtype;
 > > +        if (answer->capability > 0 && !capable(answer->capability))
 > > +                goto free_and_badperm;
 > > +        if (!protocol)
 > > +                goto free_and_noproto;
 > > +
 > > +        sock->ops = answer->ops;
 > > +        sk->prot = answer->prot;
 > > +        sk->no_check = answer->no_check;
 > > +        if (answer->reuse)
 > > +                sk->reuse = answer->reuse;
 > > +
 > > +        if (SOCK_RAW == sock->type) {
 > > +                sk->num = protocol;
 > > +                if (IPPROTO_RAW == protocol)
 > > +                        sk->protinfo.af_inet.hdrincl = 1;
 > > +        }
 > > 
 > >         if (ipv4_config.no_pmtu_disc)
 > >                 sk->protinfo.af_inet.pmtudisc = IP_PMTUDISC_DONT;
 > > @@ -365,8 +383,7 @@
 > >         sk->family      = PF_INET;
 > >         sk->protocol    = protocol;
 > > 
 > > -       sk->prot        = prot;
 > > -       sk->backlog_rcv = prot->backlog_rcv;
 > > +       sk->backlog_rcv = sk->prot->backlog_rcv;
 > > 
 > >         sk->protinfo.af_inet.ttl        = sysctl_ip_default_ttl;
 > > 
 > > @@ -969,6 +986,70 @@
 > >  extern void tcp_init(void);
 > >  extern void tcp_v4_init(struct net_proto_family *);
 > > 
 > > +/* Upon startup we insert all the elements in inetsw_array[] into
 > > + * the linked list inetsw.
 > > + */
 > > +static struct inet_protosw inetsw_array[] =
 > > +{
 > > +        {
 > > +                type:        SOCK_STREAM,
 > > +                protocol:    IPPROTO_TCP,
 > > +                prot:        &tcp_prot,
 > > +                ops:         &inet_stream_ops,
 > > +                no_check:     0,
 > > +                reuse:        0,
 > > +                capability:  -1,
 > > +        },
 > > +
 > > +        {
 > > +                type:        SOCK_DGRAM,
 > > +                protocol:    IPPROTO_UDP,
 > > +                prot:        &udp_prot,
 > > +                ops:         &inet_dgram_ops,
 > > +                no_check:    UDP_CSUM_DEFAULT,
 > > +                reuse:       0,
 > > +                capability:  -1,
 > > +       },
 > > +
 > > +
 > > +       {
 > > +               type:        SOCK_RAW,
 > > +               protocol:    IPPROTO_IP,        /* wild card */
 > > +               prot:        &raw_prot,
 > > +               ops:         &inet_dgram_ops,
 > > +               no_check:    UDP_CSUM_DEFAULT,
 > > +               reuse:       1,
 > > +               capability:  CAP_NET_RAW,
 > > +       }
 > > +}; /* struct inet_protosw inetsw_array[] */
 > > +
 > > +#define INETSW_ARRAY_LEN (sizeof(inetsw_array) / sizeof(struct inet_protosw))
 > > +
 > > +void
 > > +inet_register_protosw(struct inet_protosw *p)
 > > +{
 > > +       /* Add to the BEGINNING so that we override any existing
 > > +        * entry.  This means that when we remove this entry, the
 > > +        * system automatically returns to the old behavior.
 > > +        */
 > > +        if (p->type < SOCK_MAX) {
 > > +                br_write_lock_bh(BR_NETPROTO_LOCK);
 > > +                list_add(&p->list, &inetsw[p->type]);
 > > +                br_write_unlock_bh(BR_NETPROTO_LOCK);
 > > +        } else {
 > > +                printk(KERN_DEBUG "Ignoring attempt to register illegal socket type %d.\n",
 > > +                       p->type);
 > > +        }
 > > +} /* inet_protosw_register() */
 > > +
 > > +void
 > > +inet_unregister_protosw(struct inet_protosw *p)
 > > +{
 > > +        br_write_lock_bh(BR_NETPROTO_LOCK);
 > > +       list_del(&p->list);
 > > +       br_write_unlock_bh(BR_NETPROTO_LOCK);
 > > +} /* inet_protosw_unregister() */
 > > +
 > > 
 > >  /*
 > >   *     Called by socket.c on kernel startup.
 > > @@ -978,6 +1059,8 @@
 > >  {
 > >         struct sk_buff *dummy_skb;
 > >         struct inet_protocol *p;
 > > +       struct inet_protosw *q;
 > > +        struct list_head *r;
 > > 
 > >         printk(KERN_INFO "NET4: Linux TCP/IP 1.0 for NET4.0\n");
 > > 
 > > @@ -1003,6 +1086,14 @@
 > >                 printk("%s%s",p->name,tmp?", ":"\n");
 > >                 p = tmp;
 > >         }
 > > +
 > > +        /* Register the socket-side information for inet_create.  */
 > > +        for(r = &inetsw[0]; r < &inetsw[SOCK_MAX]; ++r) {
 > > +                INIT_LIST_HEAD(r);
 > > +        }
 > > +        for(q = inetsw_array; q < &inetsw_array[INETSW_ARRAY_LEN]; ++q) {
 > > +                inet_register_protosw(q);
 > > +        }
 > > 
 > >         /*
 > >          *      Set the ARP module up
 > > diff -u -r linux-2.4.5/net/ipv6/af_inet6.c linux/net/ipv6/af_inet6.c
 > > --- linux-2.4.5/net/ipv6/af_inet6.c     Thu Apr 12 14:11:39 2001
 > > +++ linux/net/ipv6/af_inet6.c   Mon Jun  4 18:39:53 2001
 > > @@ -10,6 +10,7 @@
 > >   *     $Id: af_inet6.c,v 1.63 2001/03/02 03:13:05 davem Exp $
 > >   *
 > >   *     Fixes:
 > > + *     piggy, Karl Knutson     :       Socket protocol table
 > >   *     Hideaki YOSHIFUJI       :       sin6_scope_id support
 > >   *     Arnaldo Melo            :       check proc_net_create return, cleanups
 > >   *
 > > @@ -44,6 +45,7 @@
 > >  #include <linux/inet.h>
 > >  #include <linux/netdevice.h>
 > >  #include <linux/icmpv6.h>
 > > +#include <linux/brlock.h>
 > >  #include <linux/smp_lock.h>
 > > 
 > >  #include <net/ip.h>
 > > @@ -71,9 +73,6 @@
 > >  MODULE_PARM(unloadable, "i");
 > >  #endif
 > > 
 > > -extern struct proto_ops inet6_stream_ops;
 > > -extern struct proto_ops inet6_dgram_ops;
 > > -
 > >  /* IPv6 procfs goodies... */
 > > 
 > >  #ifdef CONFIG_PROC_FS
 > > @@ -93,6 +92,11 @@
 > >  atomic_t inet6_sock_nr;
 > >  #endif
 > > 
 > > +/* The inetsw table contains everything that inet_create needs to
 > > + * build a new socket.
 > > + */
 > > +struct list_head inetsw6[SOCK_MAX];
 > > +
 > >  static void inet6_sock_destruct(struct sock *sk)
 > >  {
 > >         inet_sock_destruct(sk);
 > > @@ -106,47 +110,64 @@
 > >  static int inet6_create(struct socket *sock, int protocol)
 > >  {
 > >         struct sock *sk;
 > > -       struct proto *prot;
 > > +        struct list_head *p;
 > > +        struct inet_protosw *answer;
 > > 
 > >         sk = sk_alloc(PF_INET6, GFP_KERNEL, 1);
 > >         if (sk == NULL)
 > >                 goto do_oom;
 > > 
 > > -       if(sock->type == SOCK_STREAM || sock->type == SOCK_SEQPACKET) {
 > > -               if (protocol && protocol != IPPROTO_TCP)
 > > -                       goto free_and_noproto;
 > > -               protocol = IPPROTO_TCP;
 > > -               prot = &tcpv6_prot;
 > > -               sock->ops = &inet6_stream_ops;
 > > -       } else if(sock->type == SOCK_DGRAM) {
 > > -               if (protocol && protocol != IPPROTO_UDP)
 > > -                       goto free_and_noproto;
 > > -               protocol = IPPROTO_UDP;
 > > -               sk->no_check = UDP_CSUM_DEFAULT;
 > > -               prot=&udpv6_prot;
 > > -               sock->ops = &inet6_dgram_ops;
 > > -       } else if(sock->type == SOCK_RAW) {
 > > -               if (!capable(CAP_NET_RAW))
 > > -                       goto free_and_badperm;
 > > -               if (!protocol)
 > > -                       goto free_and_noproto;
 > > -               prot = &rawv6_prot;
 > > -               sock->ops = &inet6_dgram_ops;
 > > -               sk->reuse = 1;
 > > -               sk->num = protocol;
 > > -       } else {
 > > -               goto free_and_badtype;
 > > -       }
 > > -
 > > +        /* Look for the requested type/protocol pair.  */
 > > +        answer = NULL;
 > > +       br_read_lock_bh(BR_NETPROTO_LOCK);
 > > +        list_for_each(p, &inetsw6[sock->type]) {
 > > +                answer = list_entry(p, struct inet_protosw, list);
 > > +                /* Check the non-wild match.  */
 > > +                if (protocol == answer->protocol) {
 > > +                        if (protocol != IPPROTO_IP) {
 > > +                                break;
 > > +                        }
 > > +                } else {
 > > +                        /* Check for the two wild cases. */
 > > +                        if (IPPROTO_IP == protocol) {
 > > +                                protocol = answer->protocol;
 > > +                                break;
 > > +                        }
 > > +                        if (IPPROTO_IP == answer->protocol) {
 > > +                                break;
 > > +                        }
 > > +                }
 > > +                answer = NULL;
 > > +        }
 > > +       br_read_unlock_bh(BR_NETPROTO_LOCK);
 > > +
 > > +        if (!answer)
 > > +                goto free_and_badtype;
 > > +        if (answer->capability > 0 && !capable(answer->capability))
 > > +                goto free_and_badperm;
 > > +        if (!protocol)
 > > +                goto free_and_noproto;
 > > +
 > > +        sock->ops = answer->ops;
 > >         sock_init_data(sock, sk);
 > > 
 > > +       sk->prot                = answer->prot;
 > > +        sk->no_check = answer->no_check;
 > > +        if (answer->reuse)
 > > +                sk->reuse = answer->reuse;
 > > +
 > > +        if (SOCK_RAW == sock->type) {
 > > +                sk->num = protocol;
 > > +                if (IPPROTO_RAW == protocol)
 > > +                        sk->protinfo.af_inet.hdrincl = 1;
 > > +        }
 > > +
 > >         sk->destruct            = inet6_sock_destruct;
 > >         sk->zapped              = 0;
 > >         sk->family              = PF_INET6;
 > >         sk->protocol            = protocol;
 > > 
 > > -       sk->prot                = prot;
 > > -       sk->backlog_rcv         = prot->backlog_rcv;
 > > +       sk->backlog_rcv         = answer->prot->backlog_rcv;
 > > 
 > >         sk->net_pinfo.af_inet6.hop_limit  = -1;
 > >         sk->net_pinfo.af_inet6.mcast_hops = -1;
 > > @@ -175,9 +196,6 @@
 > >  #endif
 > >         MOD_INC_USE_COUNT;
 > > 
 > > -       if (sk->type==SOCK_RAW && protocol==IPPROTO_RAW)
 > > -               sk->protinfo.af_inet.hdrincl=1;
 > > -
 > >         if (sk->num) {
 > >                 /* It assumes that any protocol which allows
 > >                  * the user to assign a number at socket
 > > @@ -186,7 +204,6 @@
 > >                 sk->sport = ntohs(sk->num);
 > >                 sk->prot->hash(sk);
 > >         }
 > > -
 > >         if (sk->prot->init) {
 > >                 int err = sk->prot->init(sk);
 > >                 if (err != 0) {
 > > @@ -504,9 +521,47 @@
 > >  extern void ipv6_sysctl_unregister(void);
 > >  #endif
 > > 
 > > +static struct inet_protosw rawv6_protosw = {
 > > +        type:        SOCK_RAW,
 > > +        protocol:    IPPROTO_IP,       /* wild card */
 > > +        prot:        &rawv6_prot,
 > > +        ops:         &inet6_dgram_ops,
 > > +        no_check:    UDP_CSUM_DEFAULT,
 > > +        reuse:       1,
 > > +        capability:  CAP_NET_RAW,
 > > +};
 > > +
 > > +#define INETSW6_ARRAY_LEN (sizeof(inetsw6_array) / sizeof(struct inet_protosw))
 > > +
 > > +void
 > > +inet6_register_protosw(struct inet_protosw *p)
 > > +{
 > > +       /* Add to the BEGINNING so that we override any existing
 > > +        * entry.  This means that when we remove this entry, the
 > > +        * system automatically returns to the old behavior.
 > > +        */
 > > +        if (p->type < SOCK_MAX) {
 > > +                br_write_lock_bh(BR_NETPROTO_LOCK);
 > > +                list_add(&p->list, &inetsw6[p->type]);
 > > +                br_write_unlock_bh(BR_NETPROTO_LOCK);
 > > +        } else {
 > > +                printk(KERN_DEBUG "Ignoring attempt to register illegal socket type %d.\n",
 > > +                       p->type);
 > > +        }
 > > +} /* inet_protosw_register() */
 > > +
 > > +void
 > > +inet6_unregister_protosw(struct inet_protosw *p)
 > > +{
 > > +        br_write_lock_bh(BR_NETPROTO_LOCK);
 > > +       list_del(&p->list);
 > > +        br_write_unlock_bh(BR_NETPROTO_LOCK);
 > > +} /* inet_protosw_unregister() */
 > > +
 > >  static int __init inet6_init(void)
 > >  {
 > >         struct sk_buff *dummy_skb;
 > > +        struct list_head *r;
 > >         int err;
 > > 
 > >  #ifdef MODULE
 > > @@ -523,6 +578,16 @@
 > >                 printk(KERN_CRIT "inet6_proto_init: size fault\n");
 > >                 return -EINVAL;
 > >         }
 > > +
 > > +        /* Register the socket-side information for inet6_create.  */
 > > +        for(r = &inetsw6[0]; r < &inetsw6[SOCK_MAX]; ++r) {
 > > +                INIT_LIST_HEAD(r);
 > > +        }
 > > +
 > > +        /* We MUST register RAW sockets before we create the ICMP6,
 > > +         * IGMP6, or NDISC control sockets.
 > > +         */
 > > +        inet6_register_protosw(&rawv6_protosw);
 > > 
 > >         /*
 > >          *      ipngwg API draft makes clear that the correct semantics
 > > diff -u -r linux-2.4.5/net/ipv6/tcp_ipv6.c linux/net/ipv6/tcp_ipv6.c
 > > --- linux-2.4.5/net/ipv6/tcp_ipv6.c     Wed Apr 25 16:57:39 2001
 > > +++ linux/net/ipv6/tcp_ipv6.c   Mon Jun  4 18:35:31 2001
 > > @@ -2125,8 +2125,21 @@
 > >         "TCPv6"                 /* name                 */
 > >  };
 > > 
 > > +extern struct proto_ops inet6_stream_ops;
 > > +
 > > +static struct inet_protosw tcpv6_protosw = {
 > > +        type:        SOCK_STREAM,
 > > +        protocol:    IPPROTO_TCP,
 > > +        prot:        &tcpv6_prot,
 > > +        ops:         &inet6_stream_ops,
 > > +        no_check:     0,
 > > +        reuse:        0,
 > > +        capability:  -1,
 > > +};
 > > +
 > >  void __init tcpv6_init(void)
 > >  {
 > >         /* register inet6 protocol */
 > >         inet6_add_protocol(&tcpv6_protocol);
 > > +        inet6_register_protosw(&tcpv6_protosw);
 > >  }
 > > diff -u -r linux-2.4.5/net/ipv6/udp.c linux/net/ipv6/udp.c
 > > --- linux-2.4.5/net/ipv6/udp.c  Thu Apr 12 14:11:39 2001
 > > +++ linux/net/ipv6/udp.c        Mon Jun  4 18:36:03 2001
 > > @@ -992,7 +992,21 @@
 > >         get_port:       udp_v6_get_port,
 > >  };
 > > 
 > > +extern struct proto_ops inet6_dgram_ops;
 > > +
 > > +static struct inet_protosw udpv6_protosw = {
 > > +        type:        SOCK_DGRAM,
 > > +        protocol:    IPPROTO_UDP,
 > > +        prot:        &udpv6_prot,
 > > +        ops:         &inet6_dgram_ops,
 > > +        no_check:    UDP_CSUM_DEFAULT,
 > > +        reuse:        0,
 > > +        capability:  -1,
 > > +};
 > > +
 > > +
 > >  void __init udpv6_init(void)
 > >  {
 > >         inet6_add_protocol(&udpv6_protocol);
 > > +        inet6_register_protosw(&udpv6_protosw);
 > >  }
 > > diff -u -r linux-2.4.5/net/netsyms.c linux/net/netsyms.c
 > > --- linux-2.4.5/net/netsyms.c   Fri Apr 27 16:15:01 2001
 > > +++ linux/net/netsyms.c Mon Jun  4 11:11:30 2001
 > > @@ -234,6 +234,8 @@
 > >  EXPORT_SYMBOL(inetdev_lock);
 > >  EXPORT_SYMBOL(inet_add_protocol);
 > >  EXPORT_SYMBOL(inet_del_protocol);
 > > +EXPORT_SYMBOL(inet_register_protosw);
 > > +EXPORT_SYMBOL(inet_unregister_protosw);
 > >  EXPORT_SYMBOL(ip_route_output_key);
 > >  EXPORT_SYMBOL(ip_route_input);
 > >  EXPORT_SYMBOL(icmp_send);
 > > -
 > > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
 > > the body of a message to majordomo@vger.kernel.org
 > > More majordomo info at  http://vger.kernel.org/majordomo-info.html
 > > Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table
       [not found] <3B1E5CC1.553B4EF1@alacritech.com>
  2001-06-05 16:59 ` [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table La Monte H.P. Yarroll
@ 2001-06-06 22:15 ` David S. Miller
  2001-06-06 22:36   ` Alexander Viro
                     ` (6 more replies)
  1 sibling, 7 replies; 51+ messages in thread
From: David S. Miller @ 2001-06-06 22:15 UTC (permalink / raw)
  To: La Monte H.P. Yarroll
  Cc: Matt D. Robinson, linux-kernel, sctp-developers-list


La Monte H.P. Yarroll writes:
 > Matt D. Robinson writes:
 >  > Is there any way to add in the capability to _replace_ TCP with
 >  > your own, so you can use your own layer?

ABSOLUTELY NOT!

And I will never in my lifetime allow such a facility to be added to
the Linux kernel.

This allows people to make proprietary implementations of TCP under
Linux.  And we don't want this just as we don't want to add a way to
allow someone to do a proprietary Linux VM.

Later,
David S. Miller
davem@redhat.com

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table
  2001-06-06 22:15 ` [PATCH] sockreg2.4.5-05 " David S. Miller
@ 2001-06-06 22:36   ` Alexander Viro
  2001-06-06 22:42   ` Richard Gooch
                     ` (5 subsequent siblings)
  6 siblings, 0 replies; 51+ messages in thread
From: Alexander Viro @ 2001-06-06 22:36 UTC (permalink / raw)
  To: David S. Miller
  Cc: La Monte H.P. Yarroll, Matt D. Robinson, linux-kernel,
	sctp-developers-list



On Wed, 6 Jun 2001, David S. Miller wrote:

> This allows people to make proprietary implementations of TCP under
> Linux.  And we don't want this just as we don't want to add a way to
> allow someone to do a proprietary Linux VM.

	Erm... What stops those who want to do such implementations
from using AF_PACKET and handling the whole thing in userland?


^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table
  2001-06-06 22:15 ` [PATCH] sockreg2.4.5-05 " David S. Miller
  2001-06-06 22:36   ` Alexander Viro
@ 2001-06-06 22:42   ` Richard Gooch
  2001-06-06 22:52   ` David S. Miller
                     ` (4 subsequent siblings)
  6 siblings, 0 replies; 51+ messages in thread
From: Richard Gooch @ 2001-06-06 22:42 UTC (permalink / raw)
  To: Alexander Viro
  Cc: David S. Miller, La Monte H.P. Yarroll, Matt D. Robinson,
	linux-kernel, sctp-developers-list

Alexander Viro writes:
> 
> 
> On Wed, 6 Jun 2001, David S. Miller wrote:
> 
> > This allows people to make proprietary implementations of TCP under
> > Linux.  And we don't want this just as we don't want to add a way to
> > allow someone to do a proprietary Linux VM.
> 
> 	Erm... What stops those who want to do such implementations
> from using AF_PACKET and handling the whole thing in userland?

Just that their performance will suck. People are far less likely to
adopt a product (with an "embrace and extend" side effect) if said
product sucks performance.

Besides, it's better if people send patches to speed up our stack,
rather than having a proprietary product. Patches benefit all
mankind. Products benefit the vendor.

				Regards,

					Richard....
Permanent: rgooch@atnf.csiro.au
Current:   rgooch@ras.ucalgary.ca

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table
  2001-06-06 22:15 ` [PATCH] sockreg2.4.5-05 " David S. Miller
  2001-06-06 22:36   ` Alexander Viro
  2001-06-06 22:42   ` Richard Gooch
@ 2001-06-06 22:52   ` David S. Miller
  2001-06-06 23:21   ` Matt D. Robinson
                     ` (3 subsequent siblings)
  6 siblings, 0 replies; 51+ messages in thread
From: David S. Miller @ 2001-06-06 22:52 UTC (permalink / raw)
  To: Alexander Viro
  Cc: La Monte H.P. Yarroll, Matt D. Robinson, linux-kernel,
	sctp-developers-list


Alexander Viro writes:
 > 	Erm... What stops those who want to do such implementations
 > from using AF_PACKET and handling the whole thing in userland?

Nothing stops them, except the fact that this would be inefficient as
hell.  Streams would be quicker :-)

Later,
David S. Miller
davem@redhat.com

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table
  2001-06-06 22:15 ` [PATCH] sockreg2.4.5-05 " David S. Miller
                     ` (2 preceding siblings ...)
  2001-06-06 22:52   ` David S. Miller
@ 2001-06-06 23:21   ` Matt D. Robinson
  2001-06-06 23:51     ` Richard Gooch
                       ` (2 more replies)
  2001-06-06 23:31   ` David S. Miller
                     ` (2 subsequent siblings)
  6 siblings, 3 replies; 51+ messages in thread
From: Matt D. Robinson @ 2001-06-06 23:21 UTC (permalink / raw)
  To: David S. Miller
  Cc: La Monte H.P. Yarroll, linux-kernel, sctp-developers-list, yakker

"David S. Miller" wrote:
> 
> La Monte H.P. Yarroll writes:
>  > Matt D. Robinson writes:
>  >  > Is there any way to add in the capability to _replace_ TCP with
>  >  > your own, so you can use your own layer?
> 
> ABSOLUTELY NOT!
> 
> And I will never in my lifetime allow such a facility to be added to
> the Linux kernel.

Who's to say you will always own the stack in the Linux kernel, or
have the right to make such a statement?

> This allows people to make proprietary implementations of TCP under
> Linux.  And we don't want this just as we don't want to add a way to
> allow someone to do a proprietary Linux VM.

And if as Joe User I don't want Linux TCP, but Joe's TCP, they can't
do that (in a supportable way)?  Are you saying Linux is, "do it my
way, or it's the highway"?

Seems rather Microsoft-ish of an attitude, if you ask me.

I think this is EXACTLY the reason why you run into companies like
Caldera and Microsoft saying that Linux stifles innovation.  You say,
"Oh, we allow you to do whatever you want", and when someone really
does want to do that in a way that works for open source and for
proprietary/high-security developers, you slam the door in their face.

Quite a shame.

Take it easy,

--Matt

> Later,
> David S. Miller
> davem@redhat.com

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table
  2001-06-06 22:15 ` [PATCH] sockreg2.4.5-05 " David S. Miller
                     ` (3 preceding siblings ...)
  2001-06-06 23:21   ` Matt D. Robinson
@ 2001-06-06 23:31   ` David S. Miller
  2001-06-06 23:43   ` David S. Miller
  2001-06-07  0:14   ` Ben Greear
  6 siblings, 0 replies; 51+ messages in thread
From: David S. Miller @ 2001-06-06 23:31 UTC (permalink / raw)
  To: Matt D. Robinson
  Cc: La Monte H.P. Yarroll, linux-kernel, sctp-developers-list


Matt D. Robinson writes:
 > > This allows people to make proprietary implementations of TCP under
 > > Linux.  And we don't want this just as we don't want to add a way to
 > > allow someone to do a proprietary Linux VM.
 > 
 > And if as Joe User I don't want Linux TCP, but Joe's TCP, they can't
 > do that (in a supportable way)?  Are you saying Linux is, "do it my
 > way, or it's the highway"?

If Joe's TCP is opensource, they are more than welcome to publish such
changes.

The loadable module functionality allows proprietary binary-only
drivers for devices, not binary-only proprietary reimplementations of
core parts of the kernel.

Ask Linus himself if you do not believe me and you think my position
stinks.  He's the person you have to convince in the end.

Later,
David S. Miller
davem@redhat.com

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table
  2001-06-06 22:15 ` [PATCH] sockreg2.4.5-05 " David S. Miller
                     ` (4 preceding siblings ...)
  2001-06-06 23:31   ` David S. Miller
@ 2001-06-06 23:43   ` David S. Miller
  2001-06-07 10:03     ` Henning P. Schmiedehausen
                       ` (3 more replies)
  2001-06-07  0:14   ` Ben Greear
  6 siblings, 4 replies; 51+ messages in thread
From: David S. Miller @ 2001-06-06 23:43 UTC (permalink / raw)
  To: Ben Greear
  Cc: La Monte H.P. Yarroll, Matt D. Robinson, linux-kernel,
	sctp-developers-list


Ben Greear writes:
 > Then again, maybe someone has a reason to use a different
 > TCP stack, ie to support something like a high-availiblity stack
 > between two different machines...

Feel free to implement this and send me patches :-)

 > Why would you be scared of a proprietary  TCP stack?  If Open Source
 > is so much better (and I believe it is), then there would be nothing
 > to lose.  And if the new stack helped a small subset of people who would
 > otherwise have an even sorrier life implementing it on some other
 > platform, then that is better, right?

It's not an issue of scared or not scared.  It's an issue of what
Linus chooses to allow people to do with his kernel.  This is one of
the main reasons many of us even began to work on the Linux kernel,
because we knew our work could not be compromised in such a way.

And my current understanding is that allowing proprietary
reimplementations of the VM, VFS, and core networking, is not one of
the things which is allowed.

Later,
David S. Miller
davem@redhat.com

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table
  2001-06-06 23:21   ` Matt D. Robinson
@ 2001-06-06 23:51     ` Richard Gooch
  2001-06-07  0:51       ` David S. Miller
                         ` (4 more replies)
  2001-06-07 18:10     ` Alan Cox
  2001-06-08  1:31     ` David S. Miller
  2 siblings, 5 replies; 51+ messages in thread
From: Richard Gooch @ 2001-06-06 23:51 UTC (permalink / raw)
  To: David S. Miller
  Cc: Matt D. Robinson, La Monte H.P. Yarroll, linux-kernel,
	sctp-developers-list

David S. Miller writes:
> 
> Matt D. Robinson writes:
>  > > This allows people to make proprietary implementations of TCP under
>  > > Linux.  And we don't want this just as we don't want to add a way to
>  > > allow someone to do a proprietary Linux VM.
>  > 
>  > And if as Joe User I don't want Linux TCP, but Joe's TCP, they can't
>  > do that (in a supportable way)?  Are you saying Linux is, "do it my
>  > way, or it's the highway"?

Pardon my cynicism, but this reads more like "I'm an ACME Inc. and I
want to sell a proprietary TCP stack for Linux, please change Linux to
make this possible/easy". I doubt there are many Joe Users out there
who want to replace their TCP stack. I bet they would be much happier
to see patches go in which improve the performance of the generic
kernel.

But I'm sure there are plenty of ACME Inc.'s out there who would love
to sell a replacement TCP stack. And suck users down a proprietary
solution path. But I don't see why the Linux community should help the
ACME's of this world. And Linux is doing very nicely in the corporate
world, so we needn't to lose any sleep over what our current policies
do for our acceptance levels.

If it bothers you that Linux caters more the the users and less to the
vendors, then use another OS. We don't mind. The door is over there.
Please don't slam it on your way out.

> If Joe's TCP is opensource, they are more than welcome to publish
> such changes.

Yep. And then we can all benefit.

				Regards,

					Richard....
Permanent: rgooch@atnf.csiro.au
Current:   rgooch@ras.ucalgary.ca

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table
  2001-06-06 22:15 ` [PATCH] sockreg2.4.5-05 " David S. Miller
                     ` (5 preceding siblings ...)
  2001-06-06 23:43   ` David S. Miller
@ 2001-06-07  0:14   ` Ben Greear
  6 siblings, 0 replies; 51+ messages in thread
From: Ben Greear @ 2001-06-07  0:14 UTC (permalink / raw)
  To: David S. Miller
  Cc: La Monte H.P. Yarroll, Matt D. Robinson, linux-kernel,
	sctp-developers-list

"David S. Miller" wrote:
> 
> La Monte H.P. Yarroll writes:
>  > Matt D. Robinson writes:
>  >  > Is there any way to add in the capability to _replace_ TCP with
>  >  > your own, so you can use your own layer?
> 
> ABSOLUTELY NOT!
> 
> And I will never in my lifetime allow such a facility to be added to
> the Linux kernel.
> 
> This allows people to make proprietary implementations of TCP under
> Linux.  And we don't want this just as we don't want to add a way to
> allow someone to do a proprietary Linux VM.

Then again, maybe someone has a reason to use a different
TCP stack, ie to support something like a high-availiblity stack
between two different machines...

Why would you be scared of a proprietary  TCP stack?  If Open Source
is so much better (and I believe it is), then there would be nothing
to lose.  And if the new stack helped a small subset of people who would
otherwise have an even sorrier life implementing it on some other
platform, then that is better, right?


-- 
Ben Greear <greearb@candelatech.com>          <Ben_Greear@excite.com>
President of Candela Technologies Inc      http://www.candelatech.com
ScryMUD:  http://scry.wanfear.com     http://scry.wanfear.com/~greear

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table
  2001-06-06 23:51     ` Richard Gooch
@ 2001-06-07  0:51       ` David S. Miller
  2001-06-07  5:37         ` George Bonser
  2001-06-07  5:50         ` David S. Miller
  2001-06-07  1:22       ` [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table Ben Greear
                         ` (3 subsequent siblings)
  4 siblings, 2 replies; 51+ messages in thread
From: David S. Miller @ 2001-06-07  0:51 UTC (permalink / raw)
  To: Ben Greear
  Cc: Richard Gooch, Matt D. Robinson, La Monte H.P. Yarroll,
	linux-kernel, sctp-developers-list


Ben Greear writes:
 > a modular TCP stack might be a really
 > good option for making $$ though support fees...  If there is a
 > need to keep certain (proprietary) code out of the kernel, let
 > lawyers & public pressure do it, not overly broad technical restrictions.

There is a legal restriction, basically "Linus and the copyright
holders of the networking say no."

Later,
David S. Miller
davem@redhat.com

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table
  2001-06-06 23:51     ` Richard Gooch
  2001-06-07  0:51       ` David S. Miller
@ 2001-06-07  1:22       ` Ben Greear
  2001-06-07  5:16       ` Matt D. Robinson
                         ` (2 subsequent siblings)
  4 siblings, 0 replies; 51+ messages in thread
From: Ben Greear @ 2001-06-07  1:22 UTC (permalink / raw)
  To: Richard Gooch
  Cc: David S. Miller, Matt D. Robinson, La Monte H.P. Yarroll,
	linux-kernel, sctp-developers-list

Richard Gooch wrote:
> 
> David S. Miller writes:
> >
> > Matt D. Robinson writes:
> >  > > This allows people to make proprietary implementations of TCP under
> >  > > Linux.  And we don't want this just as we don't want to add a way to
> >  > > allow someone to do a proprietary Linux VM.
> >  >
> >  > And if as Joe User I don't want Linux TCP, but Joe's TCP, they can't
> >  > do that (in a supportable way)?  Are you saying Linux is, "do it my
> >  > way, or it's the highway"?
> 
> Pardon my cynicism, but this reads more like "I'm an ACME Inc. and I
> want to sell a proprietary TCP stack for Linux, please change Linux to
> make this possible/easy". I doubt there are many Joe Users out there
> who want to replace their TCP stack. I bet they would be much happier
> to see patches go in which improve the performance of the generic
> kernel.

Maybe Joe's TCP slows things down by 200% for the average user, so it
will never go into the kernel proper.  However, it has one vital
feature that Bob needs that the faster (normal) stack can't offer.

Bob gains if he can make the choice.  If the 200% slower  and - some sum of $$
makes him choose Joes TCP, so be it.  Joes TCP could be open source, or
written by the devil himself, and the technical decision can still be made
by Bob.

Now, if there are legal issues with a proprietary loadable module, that may
be another topic of discussion altogether.  Is there any restriction
on what kind of module you can load?  For instance, suppose I write an ethernet
driver that has a built in TCP/IP stack in it somehow?  This may not be smart,
but it is technically possible...

> If it bothers you that Linux caters more the the users and less to the
> vendors, then use another OS. We don't mind. The door is over there.
> Please don't slam it on your way out.

Don't spite potential users just in the hope that you might be
able to spite a few companies too.  There is no need for Joe's
TCP to be non-open-source...a modular TCP stack might be a really
good option for making $$ though support fees...  If there is a
need to keep certain (proprietary) code out of the kernel, let
lawyers & public pressure do it, not overly broad technical restrictions.

> 
> > If Joe's TCP is opensource, they are more than welcome to publish
> > such changes.
> 
> Yep. And then we can all benefit.

Agreed.

Ben

-- 
Ben Greear <greearb@candelatech.com>          <Ben_Greear@excite.com>
President of Candela Technologies Inc      http://www.candelatech.com
ScryMUD:  http://scry.wanfear.com     http://scry.wanfear.com/~greear

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table
  2001-06-06 23:51     ` Richard Gooch
  2001-06-07  0:51       ` David S. Miller
  2001-06-07  1:22       ` [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table Ben Greear
@ 2001-06-07  5:16       ` Matt D. Robinson
  2001-06-07 18:03         ` [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister Alan Cox
  2001-06-07  5:46       ` [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table David S. Miller
  2001-06-07  6:20       ` Richard Gooch
  4 siblings, 1 reply; 51+ messages in thread
From: Matt D. Robinson @ 2001-06-07  5:16 UTC (permalink / raw)
  To: Richard Gooch
  Cc: David S. Miller, Matt Robinson, La Monte H.P. Yarroll,
	linux-kernel, sctp-developers-list

Richard Gooch wrote:
> David S. Miller writes:
> > Matt D. Robinson writes:
> >  > > This allows people to make proprietary implementations of TCP under
> >  > > Linux.  And we don't want this just as we don't want to add a way to
> >  > > allow someone to do a proprietary Linux VM.
> >  >
> >  > And if as Joe User I don't want Linux TCP, but Joe's TCP, they can't
> >  > do that (in a supportable way)?  Are you saying Linux is, "do it my
> >  > way, or it's the highway"?
>
> Pardon my cynicism, but this reads more like "I'm an ACME Inc. and I
> want to sell a proprietary TCP stack for Linux, please change Linux to
> make this possible/easy". I doubt there are many Joe Users out there
> who want to replace their TCP stack. I bet they would be much happier
> to see patches go in which improve the performance of the generic
> kernel.

Performance Improvements != Innovation.  If the maintainers of the
Linux kernel only want evolution, not revolution, then that's fine,
but it should be a bit more clear to everyone.

Let's say someone wanted to come in and completely restructure devfs.
And let's say 75% of the people out there loved it, but you didn't.
Are you willing to stand in the way of allowing the new code to come
into the kernel for sake of your exclusive opinion?  And if you
are willing to promote the changes, what does the community say if
they don't like it?  And is this thought process consistent among
all maintainers?

Mr. Yarroll has a great patch, one that offers some help to all kinds
of developers.  I worry now that it'll either not be accepted or
it'll end up changing enough that developers using it will have a
hard time taking advantage of its benefits.

> But I'm sure there are plenty of ACME Inc.'s out there who would love
> to sell a replacement TCP stack. And suck users down a proprietary
> solution path. But I don't see why the Linux community should help the
> ACME's of this world. And Linux is doing very nicely in the corporate
> world, so we needn't to lose any sleep over what our current policies
> do for our acceptance levels.
>
> If it bothers you that Linux caters more the the users and less to the
> vendors, then use another OS. We don't mind. The door is over there.
> Please don't slam it on your way out.

I'm sorry, I normally wouldn't respond, but there are so many points
to make.  I don't mean to make this into a OSS religious war, but I'm
curious:

1) Why would you limit people's ability to use solutions that are
   not open source?  I mean, you don't do it in user space, so why
   bother doing it in the kernel?  Doesn't the eventual goal of
   opening up solutions to everyone also provide room for companies
   to make a profit, if it does nothing to hurt the kernel's
   eventual dominance over other kernels?  And if not, why not?

2) Why won't Linux take FreeBSD OSL'd code into the kernel without
   also requiring a dual license which also allows for the GNU GPL?
   I mean, the FreeBSD license is OSL certified, right?  Or is it so
   important to use GPL over other OSL's that you'd rather styme
   innovation for the sake of purity?

3) Why take the position that if you don't like it, go to some other
   OS?  What if I like Linux?  Does that mean I have to give up all
   thought of using Linux because I want a proprietary solution for
   one or two things?  Doesn't that seem completely counterintuitive
   to being "open"?

4) Why are Linux kernel developers turning into a community of
   gatekeepers who are increasingly less "open" about changes to the
   product?  Is it really these days only what Linus wants?  By that
   I mean, does he really control the majority of changes, or just
   those things he has time to look at or really cares about?  All
   those other tree components are now maintained, some loosely,
   some in a draconian fashion.  If someone isn't flexible, how is
   innovation maintained?

> > If Joe's TCP is opensource, they are more than welcome to publish
> > such changes.
>
> Yep. And then we can all benefit.

And if it's released under the FreeBSD OSL, it won't be placed into
the Linux kernel (at least according to one rather important maintainer).
So Linux users as a whole won't benefit.  And that's a real shame.

Just my opinion.  I just get the feeling that some of the maintainers
are taking a "I'd rather cut off my nose to spite my face" stand on
their beliefs rather than considering how the Linux kernel can evolve
to help everyone -- even those that want to make money.  The kernel
can allow for both, but they (meaning the maintainers) just choose not
to permit it.  Maybe they just want some more of those RedHat stock
options ...

>                                 Regards,
>
>                                         Richard....

See ya,

--Matt

P.S.  I guess the next thing on the list for the Linux kernel is to
      create WHQL-like process for drivers before the code can end up
      in newer kernel revisions.  Then I'll really know things have gone
      into the toilet.


^ permalink raw reply	[flat|nested] 51+ messages in thread

* RE: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table
  2001-06-07  0:51       ` David S. Miller
@ 2001-06-07  5:37         ` George Bonser
  2001-06-07  5:50         ` David S. Miller
  1 sibling, 0 replies; 51+ messages in thread
From: George Bonser @ 2001-06-07  5:37 UTC (permalink / raw)
  To: David S. Miller, linux-kernel

> Ben Greear writes:
>  > a modular TCP stack might be a really
>  > good option for making $$ though support fees...  If there is a
>  > need to keep certain (proprietary) code out of the kernel, let
>  > lawyers & public pressure do it, not overly broad technical
> restrictions.
>
> There is a legal restriction, basically "Linus and the copyright
> holders of the networking say no."
>
> Later,
> David S. Miller
> davem@redhat.com

There is, of course, one basic problem with that argument. While you can say
(and probably rightly so) that such a change would not be included in Linus'
kernel, I think anyone is allowed to post a patch that might make it
possible to add protocols as modules. If anyone chooses to use it is each
individual's decision but you could not prevent ACME from creating a patch
that allows protocol modules as long as they distributed the patch. Also,  I
know that you are allowed to distribute proprietary modules in binary form
but are there any restrictions on what function these modules can perform?
I don't remember seeing any such restrictions.

In short, while you can refuse to accept such patches or support any
problems arising from their use, I would think that ACME has the right to
patch the kernel to make such a thing possible if they want to and there is
nothing (as far as I know) that anyone can do about it as long as they make
those patches public.  So, ACME can say that to use ACME Super FooWare you
will need the ACME Super FooKernel with our FooModule that is distributed in
binary format. If you want to build the FooKernel, here is the patch but the
module is still binary.


^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table
  2001-06-06 23:51     ` Richard Gooch
                         ` (2 preceding siblings ...)
  2001-06-07  5:16       ` Matt D. Robinson
@ 2001-06-07  5:46       ` David S. Miller
  2001-06-07  6:20       ` Richard Gooch
  4 siblings, 0 replies; 51+ messages in thread
From: David S. Miller @ 2001-06-07  5:46 UTC (permalink / raw)
  To: Matt D. Robinson
  Cc: Richard Gooch, La Monte H.P. Yarroll, linux-kernel, sctp-developers-list


Matt D. Robinson writes:
 > P.S.  I guess the next thing on the list for the Linux kernel is to
 >       create WHQL-like process for drivers before the code can end up
 >       in newer kernel revisions.  Then I'll really know things have gone
 >       into the toilet.

Just remember that the allowance of proprietary device driver kernel
modules is a special exception to the licensing of the kernel, not the
rule.  And some days even this exception becomes close to regrettable.

Other people seem to appreciate when the GPL camp isn't telling them
how to license their own code.  And just as fairly it'd be nice if
people didn't tell us what to do with the licensing of the Linux
sources.

(I'm not a "use opensource or you're a maggot" person, I just choose
 to not assosciate myself with sources not using that kind of
 licensing.  Linux is one of those safe havens for myself and
 others.  How would you like it if I were to jeapordize your own
 legitimate paradise?).

Later,
David S. Miller
davem@redhat.com


^ permalink raw reply	[flat|nested] 51+ messages in thread

* RE: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table
  2001-06-07  0:51       ` David S. Miller
  2001-06-07  5:37         ` George Bonser
@ 2001-06-07  5:50         ` David S. Miller
  2001-06-07  6:00           ` George Bonser
  2001-06-07 15:18           ` watermodem
  1 sibling, 2 replies; 51+ messages in thread
From: David S. Miller @ 2001-06-07  5:50 UTC (permalink / raw)
  To: George Bonser; +Cc: linux-kernel


George Bonser writes:
 > There is, of course, one basic problem with that argument. While you can say
 > (and probably rightly so) that such a change would not be included in Linus'
 > kernel, I think anyone is allowed to post a patch that might make it
 > possible to add protocols as modules. If anyone chooses to use it is each
 > individual's decision but you could not prevent ACME from creating a patch
 > that allows protocol modules as long as they distributed the patch. Also,  I
 > know that you are allowed to distribute proprietary modules in binary form
 > but are there any restrictions on what function these modules can perform?
 > I don't remember seeing any such restrictions.

People can post whatever patches which do whatever, sure.
But this isn't what matters.

What matters is the API under which a binary-only module may interface
to the kernel.  Linus specifies that only the module exports in his
tree fall into this API.

As I stated in another email, the allowance of binary-only kernel
modules is a special exception to the licensing of the kernel made by
Linus.  The GPL by itself, does not allow this at all.

Later,
David S. Miller
davem@redhat.com


^ permalink raw reply	[flat|nested] 51+ messages in thread

* RE: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table
  2001-06-07  5:50         ` David S. Miller
@ 2001-06-07  6:00           ` George Bonser
  2001-06-07 15:18           ` watermodem
  1 sibling, 0 replies; 51+ messages in thread
From: George Bonser @ 2001-06-07  6:00 UTC (permalink / raw)
  To: David S. Miller; +Cc: linux-kernel


> What matters is the API under which a binary-only module may interface
> to the kernel.  Linus specifies that only the module exports in his
> tree fall into this API.

Ok, I was not aware of that stipulation. So to be very strict in the
interpretation, if there is a module export that is in the -ac kernels, ACME
could not make a binary module that depends on it until/if it makes it to
Linus' tree. Hmmm, Ok.

> As I stated in another email, the allowance of binary-only kernel
> modules is a special exception to the licensing of the kernel made by
> Linus.  The GPL by itself, does not allow this at all.

Right.  The GPL still allows one to "embrace and extend" it :-)


^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table
  2001-06-06 23:51     ` Richard Gooch
                         ` (3 preceding siblings ...)
  2001-06-07  5:46       ` [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table David S. Miller
@ 2001-06-07  6:20       ` Richard Gooch
  2001-06-07  6:47         ` Matt D. Robinson
  4 siblings, 1 reply; 51+ messages in thread
From: Richard Gooch @ 2001-06-07  6:20 UTC (permalink / raw)
  To: Matt D. Robinson
  Cc: David S. Miller, La Monte H.P. Yarroll, linux-kernel,
	sctp-developers-list

Matt D. Robinson writes:
> Richard Gooch wrote:
> > David S. Miller writes:
> > > Matt D. Robinson writes:
> > >  > > This allows people to make proprietary implementations of TCP under
> > >  > > Linux.  And we don't want this just as we don't want to add a way to
> > >  > > allow someone to do a proprietary Linux VM.
> > >  >
> > >  > And if as Joe User I don't want Linux TCP, but Joe's TCP, they can't
> > >  > do that (in a supportable way)?  Are you saying Linux is, "do it my
> > >  > way, or it's the highway"?
> >
> > Pardon my cynicism, but this reads more like "I'm an ACME Inc. and I
> > want to sell a proprietary TCP stack for Linux, please change Linux to
> > make this possible/easy". I doubt there are many Joe Users out there
> > who want to replace their TCP stack. I bet they would be much happier
> > to see patches go in which improve the performance of the generic
> > kernel.

I can see this thread is degenerating. I don't plan on responding
after this. I've said my piece.

> Performance Improvements != Innovation.  If the maintainers of the
> Linux kernel only want evolution, not revolution, then that's fine,
> but it should be a bit more clear to everyone.
> 
> Let's say someone wanted to come in and completely restructure devfs.
> And let's say 75% of the people out there loved it, but you didn't.
> Are you willing to stand in the way of allowing the new code to come
> into the kernel for sake of your exclusive opinion?  And if you
> are willing to promote the changes, what does the community say if
> they don't like it?  And is this thought process consistent among
> all maintainers?

I'm the maintainer of devfs, so I'll judge things on their merits as I
see them. If I think something is a bad idea, I'll reject it. If 75%
of people disagree with me, then so be it. I'll listen to others, but
in the and I'll do what I think is right. Devfs had plenty of
opposition. I thought I was right so I went ahead and implemented it.

Ultimately, Linus decides, of course.

> Mr. Yarroll has a great patch, one that offers some help to all kinds
> of developers.  I worry now that it'll either not be accepted or
> it'll end up changing enough that developers using it will have a
> hard time taking advantage of its benefits.

Perhaps if lots of OSS developers call for the changes to be included,
Dave and Linus will change their minds. Or perhaps someone will figure
out a way of give the OSS people what they want without sacrificing
the policy that Dave expressed. Or perhaps few people will really want
to replace the TCP stack. Time will tell.

> > But I'm sure there are plenty of ACME Inc.'s out there who would love
> > to sell a replacement TCP stack. And suck users down a proprietary
> > solution path. But I don't see why the Linux community should help the
> > ACME's of this world. And Linux is doing very nicely in the corporate
> > world, so we needn't to lose any sleep over what our current policies
> > do for our acceptance levels.
> >
> > If it bothers you that Linux caters more the the users and less to the
> > vendors, then use another OS. We don't mind. The door is over there.
> > Please don't slam it on your way out.
> 
> I'm sorry, I normally wouldn't respond, but there are so many points
> to make.  I don't mean to make this into a OSS religious war, but I'm
> curious:
> 
> 1) Why would you limit people's ability to use solutions that are
>    not open source?  I mean, you don't do it in user space, so why
>    bother doing it in the kernel?  Doesn't the eventual goal of
>    opening up solutions to everyone also provide room for companies
>    to make a profit, if it does nothing to hurt the kernel's
>    eventual dominance over other kernels?  And if not, why not?

Actually, it is done in user-space. See GPL'ed libraries (c.f. LGPL'ed
libraries).

> 2) Why won't Linux take FreeBSD OSL'd code into the kernel without
>    also requiring a dual license which also allows for the GNU GPL?
>    I mean, the FreeBSD license is OSL certified, right?  Or is it so
>    important to use GPL over other OSL's that you'd rather styme
>    innovation for the sake of purity?

Yep, the Linux crowd prefer the GPL and the *BSD crowd prefer their
license. Different philosophy. We think the GPL is better for the
greater good, they think the BSD license is better.

> 3) Why take the position that if you don't like it, go to some other
>    OS?  What if I like Linux?  Does that mean I have to give up all
>    thought of using Linux because I want a proprietary solution for
>    one or two things?  Doesn't that seem completely counterintuitive
>    to being "open"?

Look, the GPL is the license that Linux was written under, and is the
license that attracted all these developers. We're already being more
friendly to proprietary solutions than the GPL strictly allows. Be
happy with that. A line has been drawn. Live with it. Either Linux
provides sufficient benefit that it's worth it for your company to
continue working with it, or you decide you can't live with the
restrictions and change to another OS. It's your choice. Don't bitch
about it. No-one is forcing you to use Linux.

People have to make all sorts of choices. Chosing to use proprietary
software means you have to give up certain freedoms. People do it
every day, and pay money for the privilege.

> 4) Why are Linux kernel developers turning into a community of
>    gatekeepers who are increasingly less "open" about changes to the
>    product?  Is it really these days only what Linus wants?  By that
>    I mean, does he really control the majority of changes, or just
>    those things he has time to look at or really cares about?  All
>    those other tree components are now maintained, some loosely,
>    some in a draconian fashion.  If someone isn't flexible, how is
>    innovation maintained?

If the community thinks someone isn't performing, they get replaced.
It's happened in the kernel, and it's happened in other OSS
projects. Innovation doesn't appear to be suffering.

> > > If Joe's TCP is opensource, they are more than welcome to publish
> > > such changes.
> >
> > Yep. And then we can all benefit.
> 
> And if it's released under the FreeBSD OSL, it won't be placed into
> the Linux kernel (at least according to one rather important
> maintainer).  So Linux users as a whole won't benefit.  And that's a
> real shame.

Quite a few developers are happy to dual license their code, if the
original license was BSD.

> Just my opinion.  I just get the feeling that some of the
> maintainers are taking a "I'd rather cut off my nose to spite my
> face" stand on their beliefs rather than considering how the Linux
> kernel can evolve to help everyone -- even those that want to make
> money.  The kernel can allow for both, but they (meaning the
> maintainers) just choose not to permit it.

This isn't about spite. You just don't get what Linux is about. It's a
hackers' OS. Made by hackers for hackers. It's great that many other
people can use it, and that people can make money off it, more power
to them. But ultimately, we *don't care* if others use it. Sure, it's
nice if others do, and we try and help them. But not by sacrificing
what we believe in. And no-one should ask us to.

> Maybe they just want some more of those RedHat stock options ...

How dare you! This isn't about RedHat stock options. I don't have any
myself, and people like Alan and Dave have shown their integrity and
their commitment to the community and don't deserve to have mud slung
at them. Maybe the problem is that you're trying to push a proprietary
product, and want the kernel to be changed to suit your narrow,
commercial interests, and the "gatekeepers" aren't rolling out the red
carpet for you.

Get real, mate.

				Regards,

					Richard....
Permanent: rgooch@atnf.csiro.au
Current:   rgooch@ras.ucalgary.ca

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table
  2001-06-07  6:20       ` Richard Gooch
@ 2001-06-07  6:47         ` Matt D. Robinson
  0 siblings, 0 replies; 51+ messages in thread
From: Matt D. Robinson @ 2001-06-07  6:47 UTC (permalink / raw)
  To: Richard Gooch
  Cc: David S. Miller, La Monte H.P. Yarroll, linux-kernel,
	sctp-developers-list

Richard Gooch wrote:
> > Maybe they just want some more of those RedHat stock options ...
>
> How dare you! This isn't about RedHat stock options. I don't have any
> myself, and people like Alan and Dave have shown their integrity and
> their commitment to the community and don't deserve to have mud slung
> at them. Maybe the problem is that you're trying to push a proprietary
> product, and want the kernel to be changed to suit your narrow,
> commercial interests, and the "gatekeepers" aren't rolling out the red
> carpet for you.

Just for the record ...

	^options ...^& :)

I didn't think it was required.  Back to my little world where people
can actually get along and work together to make things better and
can forget about self-interest, egos, and having to defeat some greater
evil, even for a little while.

( ... )

--Matt

>                                 Regards,
>
>                                         Richard....


^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table
  2001-06-06 23:43   ` David S. Miller
@ 2001-06-07 10:03     ` Henning P. Schmiedehausen
  2001-06-07 10:50       ` Daniel Phillips
  2001-06-07 17:52       ` Alan Cox
  2001-06-07 10:05     ` [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table Russell King
                       ` (2 subsequent siblings)
  3 siblings, 2 replies; 51+ messages in thread
From: Henning P. Schmiedehausen @ 2001-06-07 10:03 UTC (permalink / raw)
  To: linux-kernel

"David S. Miller" <davem@redhat.com> writes:

>And my current understanding is that allowing proprietary
>reimplementations of the VM, VFS, and core networking, is not one of
>the things which is allowed.

...is wanted (by you and possibly Linus). Not ...is allowed. 
 
It _is_ already allowed. Someone can use the posted patch which is GPL
open source, put it into the kernel and use their proprietary module.

And this is legal according to the "Kernel GPL, Linus Torvalds edition
(TM)" which says "any loadable module can be binary only". Not "only
loadable modules which are drivers". It may not be the intention but
it is the fact.

The cat is already out of the box. Ok, someone will have to maintain
the small glue patch separate from the kernel but you're already
screwed. You, as a nay-sayer, just make work a little harder for some
of the really useful uses of such an addition and life a little easier
for companies that supply such a feature with their OS and say that
Linux, oops, DaveM stifles and hinders inovation because of ego. And
that a "shared source" model avoids single persons jumping up and down
until they're blue in their face to block others. And that their code
base will not fork over such a minor issue.

And all this is still a part of "freedom".

	Regards
		Henning

[ I consider your position a good and valid one from a "pure" view and
I really like it. But reality is different. And you should _work_ with
the people, and help them to keep their stuff in the open source and
not insult them. ]

-- 
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen       -- Geschaeftsfuehrer
INTERMETA - Gesellschaft fuer Mehrwertdienste mbH     hps@intermeta.de

Am Schwabachgrund 22  Fon.: 09131 / 50654-0   info@intermeta.de
D-91054 Buckenhof     Fax.: 09131 / 50654-20   

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table
  2001-06-06 23:43   ` David S. Miller
  2001-06-07 10:03     ` Henning P. Schmiedehausen
@ 2001-06-07 10:05     ` Russell King
  2001-06-07 15:27       ` Keith Owens
  2001-06-07 11:25     ` David S. Miller
  2001-06-07 11:25     ` David S. Miller
  3 siblings, 1 reply; 51+ messages in thread
From: Russell King @ 2001-06-07 10:05 UTC (permalink / raw)
  To: David S. Miller; +Cc: linux-kernel

On Wed, Jun 06, 2001 at 04:43:55PM -0700, David S. Miller wrote:
> And my current understanding is that allowing proprietary
> reimplementations of the VM, VFS, and core networking, is not one of
> the things which is allowed.

Umm, any commercial company can come along and re-implement any part of
the Linux kernel, produce a distribution or supply kernel binary images
as long as they make available the source code to the people they
supply the kernel binary to, and no more.

People do this already with the kernel.  You're not really preventing
this, and neither does the GPL prevent it.

--
Russell King (rmk@arm.linux.org.uk)                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html


^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table
  2001-06-07 10:03     ` Henning P. Schmiedehausen
@ 2001-06-07 10:50       ` Daniel Phillips
  2001-06-07 17:52       ` Alan Cox
  1 sibling, 0 replies; 51+ messages in thread
From: Daniel Phillips @ 2001-06-07 10:50 UTC (permalink / raw)
  To: hps, Henning P. Schmiedehausen, linux-kernel

On Thursday 07 June 2001 12:03, Henning P. Schmiedehausen wrote:
> "David S. Miller" <davem@redhat.com> writes:
> >And my current understanding is that allowing proprietary
> >reimplementations of the VM, VFS, and core networking, is not one of
> >the things which is allowed.
>
> ...is wanted (by you and possibly Linus). Not ...is allowed.
>
> It _is_ already allowed. Someone can use the posted patch which is
> GPL open source, put it into the kernel and use their proprietary
> module.
>
> And this is legal according to the "Kernel GPL, Linus Torvalds
> edition (TM)" which says "any loadable module can be binary only".
> Not "only loadable modules which are drivers". It may not be the
> intention but it is the fact.

I seem to recall something about binary modules being ok as long as 
they stick to the published interface, which would let out binary-only 
extensions to core kernel functionality.  This would seem to permit 
reimplementation.

--
Daniel

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table
  2001-06-06 23:43   ` David S. Miller
  2001-06-07 10:03     ` Henning P. Schmiedehausen
  2001-06-07 10:05     ` [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table Russell King
@ 2001-06-07 11:25     ` David S. Miller
  2001-06-07 11:25     ` David S. Miller
  3 siblings, 0 replies; 51+ messages in thread
From: David S. Miller @ 2001-06-07 11:25 UTC (permalink / raw)
  To: hps; +Cc: linux-kernel


Henning P. Schmiedehausen writes:
 > And this is legal according to the "Kernel GPL, Linus Torvalds edition
 > (TM)" which says "any loadable module can be binary only". Not "only
 > loadable modules which are drivers". It may not be the intention but
 > it is the fact.

Where is this text you are quoting?

And I didn't say it's ok "only for drivers", I said "only when using
the module exported symbols found in Linus's kernel".

Later,
David S. Miller
davem@redhat.com

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table
  2001-06-06 23:43   ` David S. Miller
                       ` (2 preceding siblings ...)
  2001-06-07 11:25     ` David S. Miller
@ 2001-06-07 11:25     ` David S. Miller
  3 siblings, 0 replies; 51+ messages in thread
From: David S. Miller @ 2001-06-07 11:25 UTC (permalink / raw)
  To: Russell King; +Cc: linux-kernel


Russell King writes:
 > Umm, any commercial company can come along and re-implement any part of
 > the Linux kernel, produce a distribution or supply kernel binary images
 > as long as they make available the source code to the people they
 > supply the kernel binary to, and no more.
 > 
 > People do this already with the kernel.  You're not really preventing
 > this, and neither does the GPL prevent it.

Sure, but this isn't the case I'm talking about.

Later,
David S. Miller
davem@redhat.com


^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table
  2001-06-07  5:50         ` David S. Miller
  2001-06-07  6:00           ` George Bonser
@ 2001-06-07 15:18           ` watermodem
  2001-06-07 15:51             ` Mike Galbraith
  1 sibling, 1 reply; 51+ messages in thread
From: watermodem @ 2001-06-07 15:18 UTC (permalink / raw)
  To: David S. Miller; +Cc: linux-kernel

"David S. Miller" wrote:
> 
> George Bonser writes:
>  > There is, of course, one basic problem with that argument. While you can say
>  > (and probably rightly so) that such a change would not be included in Linus'
>  > kernel, I think anyone is allowed to post a patch that might make it
>  > possible to add protocols as modules. If anyone chooses to use it is each
>  > individual's decision but you could not prevent ACME from creating a patch
>  > that allows protocol modules as long as they distributed the patch. Also,  I
>  > know that you are allowed to distribute proprietary modules in binary form
>  > but are there any restrictions on what function these modules can perform?
>  > I don't remember seeing any such restrictions.
> 
> People can post whatever patches which do whatever, sure.
> But this isn't what matters.
> 
> What matters is the API under which a binary-only module may interface
> to the kernel.  Linus specifies that only the module exports in his
> tree fall into this API.
> 
> As I stated in another email, the allowance of binary-only kernel
> modules is a special exception to the licensing of the kernel made by
> Linus.  The GPL by itself, does not allow this at all.
> 
> Later,
> David S. Miller
> davem@redhat.com

David,

   What is your real problem with La Monte's Code.
   I don't buy your more "blessed than thou" argument.
   It is a typical response one normally sees in large
   organizations from folk with "empires" to protect.
   Coming from the "land of warring tribes" firm it is
   a attitude I have seen often.  My response is take 
   a vacation, chill out and reassess.

Watermodem 
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table
  2001-06-07 10:05     ` [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table Russell King
@ 2001-06-07 15:27       ` Keith Owens
  2001-06-07 17:01         ` David Woodhouse
  0 siblings, 1 reply; 51+ messages in thread
From: Keith Owens @ 2001-06-07 15:27 UTC (permalink / raw)
  To: Russell King; +Cc: David S. Miller, linux-kernel

On Thu, 7 Jun 2001 11:05:07 +0100, 
Russell King <rmk@arm.linux.org.uk> wrote:
>Umm, any commercial company can come along and re-implement any part of
>the Linux kernel, produce a distribution or supply kernel binary images
>as long as they make available the source code to the people they
>supply the kernel binary to, and no more.

GNU General Public License Version 2, June 1991.  Section 3(b) says
"any third party", not just customers.

Nothing in the GPL restricts the source being supplied to "the people
they supply the kernel binary to, and no more".  Even if a company
refused to supply their source changes to anybody except a customer
(which would violate the GPL anyway), section 2(b) explictly allows
those customers to give the source to anybody.  Attempts to restrict
distribution will void your rights under the GPL, see section 4.


^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table
  2001-06-07 15:18           ` watermodem
@ 2001-06-07 15:51             ` Mike Galbraith
  2001-06-09 22:09               ` [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregistertable watermodem
  0 siblings, 1 reply; 51+ messages in thread
From: Mike Galbraith @ 2001-06-07 15:51 UTC (permalink / raw)
  To: watermodem; +Cc: linux-kernel

On Thu, 7 Jun 2001, watermodem wrote:

> "David S. Miller" wrote:
> >
> > George Bonser writes:
> >  > There is, of course, one basic problem with that argument. While you can say
> >  > (and probably rightly so) that such a change would not be included in Linus'
> >  > kernel, I think anyone is allowed to post a patch that might make it
> >  > possible to add protocols as modules. If anyone chooses to use it is each
> >  > individual's decision but you could not prevent ACME from creating a patch
> >  > that allows protocol modules as long as they distributed the patch. Also,  I
> >  > know that you are allowed to distribute proprietary modules in binary form
> >  > but are there any restrictions on what function these modules can perform?
> >  > I don't remember seeing any such restrictions.
> >
> > People can post whatever patches which do whatever, sure.
> > But this isn't what matters.
> >
> > What matters is the API under which a binary-only module may interface
> > to the kernel.  Linus specifies that only the module exports in his
> > tree fall into this API.
> >
> > As I stated in another email, the allowance of binary-only kernel
> > modules is a special exception to the licensing of the kernel made by
> > Linus.  The GPL by itself, does not allow this at all.
> >
> > Later,
> > David S. Miller
> > davem@redhat.com
>
> David,
>
>    What is your real problem with La Monte's Code.
>    I don't buy your more "blessed than thou" argument.
>    It is a typical response one normally sees in large
>    organizations from folk with "empires" to protect.
>    Coming from the "land of warring tribes" firm it is
>    a attitude I have seen often.  My response is take
>    a vacation, chill out and reassess.

What words would you like to put in his mouth to replace those he used?

	-Mike


^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table
  2001-06-07 15:27       ` Keith Owens
@ 2001-06-07 17:01         ` David Woodhouse
  0 siblings, 0 replies; 51+ messages in thread
From: David Woodhouse @ 2001-06-07 17:01 UTC (permalink / raw)
  To: Keith Owens; +Cc: Russell King, David S. Miller, linux-kernel


kaos@ocs.com.au said:
> Russell King <rmk@arm.linux.org.uk> wrote:
> > supply kernel binary images as long as they make available the source
> > code to the people they supply the kernel binary to, and no more.

> GNU General Public License Version 2, June 1991.  Section 3(b) says
> "any third party", not just customers.

It does indeed. Pick any three words and take them out of context, however, 
and the result is utterly meaningless.

The paragraph from which you took those words is listed as one of three
_alternatives_. One of the alternatives does not require that the source be
made available to "any third party".

> Nothing in the GPL restricts the source being supplied to "the people
> they supply the kernel binary to, and no more".

If the source is not distributed with the binary, you are correct.
If the source _is_ distributed with the binary, you are wrong. See option (a) below:

GPL>  3. You may copy and distribute the Program (or a work based on it,
GPL> under Section 2) in object code or executable form under the terms of
GPL> Sections 1 and 2 above provided that you also do one of the following:
GPL> 
GPL>     a) Accompany it with the complete corresponding machine-readable
GPL>     source code, which must be distributed under the terms of Sections
GPL>     1 and 2 above on a medium customarily used for software interchange; or,
GPL> 
GPL>     b) Accompany it with a written offer, valid for at least three
GPL>     years, to give any third party, for a charge no more than your
GPL>     cost of physically performing source distribution, a complete
GPL>     machine-readable copy of the corresponding source code, to be
GPL>     distributed under the terms of Sections 1 and 2 above on a medium
GPL>     customarily used for software interchange; or,
GPL> 
GPL>     c) Accompany it with the information you received as to the offer
GPL>     to distribute corresponding source code.  (This alternative is
GPL>     allowed only for noncommercial distribution and only if you
GPL>     received the program in object code or executable form with such
GPL>     an offer, in accord with Subsection b above.)


I may choose option (a). Which does not oblige me to give source to a third
party.

You can ship source with the binaries, _OR_ you must make sure the source is 
available to all third parties. You don't have to do both.

--
dwmw2



^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table
  2001-06-07 10:03     ` Henning P. Schmiedehausen
  2001-06-07 10:50       ` Daniel Phillips
@ 2001-06-07 17:52       ` Alan Cox
  2001-06-08  8:29         ` Henning P. Schmiedehausen
  1 sibling, 1 reply; 51+ messages in thread
From: Alan Cox @ 2001-06-07 17:52 UTC (permalink / raw)
  To: hps; +Cc: linux-kernel

> And this is legal according to the "Kernel GPL, Linus Torvalds edition
> (TM)" which says "any loadable module can be binary only". Not "only
> loadable modules which are drivers". It may not be the intention but
> it is the fact.

Linus opinion on this is irrelevant. Neither I nor the FSF nor many others
have released code under anything but the vanilla GPL. By merging such code
Linus lost his ability to vary the license.

So it comes down to the question of whether the module is linking (which is
about dependancies and requirements) and what the legal scope is. Which
is a matter for lawyers.

Anyone releasing binary only modules does so having made their own appropriate
risk assessment and having talked (I hope) to their insurers


^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister
  2001-06-07  5:16       ` Matt D. Robinson
@ 2001-06-07 18:03         ` Alan Cox
  0 siblings, 0 replies; 51+ messages in thread
From: Alan Cox @ 2001-06-07 18:03 UTC (permalink / raw)
  To: Matt D. Robinson
  Cc: Richard Gooch, David S. Miller, Matt Robinson,
	La Monte H.P. Yarroll, linux-kernel, sctp-developers-list

> 1) Why would you limit people's ability to use solutions that are
>    not open source?  I mean, you don't do it in user space, so why
>    bother doing it in the kernel?  Doesn't the eventual goal of

It would be a nightmare to support or maintain and would be bad for the
Linux kernel. A random app is completely seperate so doesnt harm kernel
stability

> 2) Why won't Linux take FreeBSD OSL'd code into the kernel without
>    also requiring a dual license which also allows for the GNU GPL?

On legal advice. The BSD license has insufficient protection against
a variety of patent related problems. 

Alan


^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table
  2001-06-06 23:21   ` Matt D. Robinson
  2001-06-06 23:51     ` Richard Gooch
@ 2001-06-07 18:10     ` Alan Cox
  2001-06-08  1:31     ` David S. Miller
  2 siblings, 0 replies; 51+ messages in thread
From: Alan Cox @ 2001-06-07 18:10 UTC (permalink / raw)
  To: Matt D. Robinson
  Cc: David S. Miller, La Monte H.P. Yarroll, linux-kernel,
	sctp-developers-list, yakker

> > And I will never in my lifetime allow such a facility to be added to
> > the Linux kernel.
> 
> Who's to say you will always own the stack in the Linux kernel, or
> have the right to make such a statement?

Its called being a copyright holder. Or better known as 'having done much of
the work you intend to freeload onto'

> And if as Joe User I don't want Linux TCP, but Joe's TCP, they can't
> do that (in a supportable way)?  Are you saying Linux is, "do it my
> way, or it's the highway"?

No. The GPL says do it the free way, any vendor, any author, but free. It 
doesnt say 'One snowboard nutter in california'. Very different to the MS way


^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table
  2001-06-06 22:07   ` La Monte H.P. Yarroll
@ 2001-06-07 19:11     ` Matthias Urlichs
  0 siblings, 0 replies; 51+ messages in thread
From: Matthias Urlichs @ 2001-06-07 19:11 UTC (permalink / raw)
  To: linux-kernel

Ahem...

David S. Miller wrote:
>This allows people to make proprietary implementations of TCP under
>Linux.  And we don't want this just as we don't want to add a way to
>allow someone to do a proprietary Linux VM.

*Sigh* and thence begin the proprietary-vs-OpenSource flame wars again.

_Any_ open protocol can be abused for proprietary stuff. It can also 
be used for Something Entirely Different.

Personally, I would _love_ to have TCP as a module, just so that the 
system can unload it on my poor underpowered laptop when it's not 
needed.

The fact that you can abuse this ability in order to replace the 
current TCP with Something Proprietary And Therefore Evil is a 
no-brainer. Anybody can do exactly the same thing with my network 
card driver, or the Unix-domain code, or the NFS server, or ...

So what's so damn special about the TCP stack that you need to shout 
"Absolutely not" here? I don't get it.

-- 
Matthias Urlichs

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table
  2001-06-06 23:21   ` Matt D. Robinson
  2001-06-06 23:51     ` Richard Gooch
  2001-06-07 18:10     ` Alan Cox
@ 2001-06-08  1:31     ` David S. Miller
  2 siblings, 0 replies; 51+ messages in thread
From: David S. Miller @ 2001-06-08  1:31 UTC (permalink / raw)
  To: Alan Cox
  Cc: Matt D. Robinson, La Monte H.P. Yarroll, linux-kernel,
	sctp-developers-list


Alan Cox writes:
 > 'One snowboard nutter in california'

For those not in the know, I'm a nut, I snowboard, and I live in
California. :-)

Later,
David S. Miller
davem@redhat.com

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table
  2001-06-07 17:52       ` Alan Cox
@ 2001-06-08  8:29         ` Henning P. Schmiedehausen
  2001-06-08 16:42           ` Alan Cox
  2001-06-08 22:54           ` Albert D. Cahalan
  0 siblings, 2 replies; 51+ messages in thread
From: Henning P. Schmiedehausen @ 2001-06-08  8:29 UTC (permalink / raw)
  To: linux-kernel

Alan Cox <alan@lxorguk.ukuu.org.uk> writes:

>> And this is legal according to the "Kernel GPL, Linus Torvalds edition
>> (TM)" which says "any loadable module can be binary only". Not "only
>> loadable modules which are drivers". It may not be the intention but
>> it is the fact.

>Linus opinion on this is irrelevant. Neither I nor the FSF nor many others
>have released code under anything but the vanilla GPL. By merging such code
>Linus lost his ability to vary the license.

Ok, this is a new opinion, because it voids the "using the published
module ABI is unconditionally ok as stated again and again.

>So it comes down to the question of whether the module is linking (which is
>about dependancies and requirements) and what the legal scope is. Which
>is a matter for lawyers.

And this would void DaveMs' argument, that only the "official in
Linus' kernel published interface is allowed for binary modules". This
would mean, that putting the posted, unofficial patch under GPL into
the kernel and then using this interface for a binary module is just
the same as using only the official ABI from a lawyers' point of
view! 

This would make DaveMs' position even less understandable, because
there would be no difference for a proprietary vendor but keeping the
patch out of the kernel makes life harder for people like the original
poster that want to test new (open sourced) protocols like SCTP.

> Anyone releasing binary only modules does so having made their own
> appropriate risk assessment and having talked (I hope) to their
> insurers

Ugh, this is a sentence we're bound to read out of context on ZDNet
and m$.com... =:-( (Linux head developer warns companies to do risk
assessment before releasing drivers for Linux... Film at 11.)

	Regards
		Henning

-- 
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen       -- Geschaeftsfuehrer
INTERMETA - Gesellschaft fuer Mehrwertdienste mbH     hps@intermeta.de

Am Schwabachgrund 22  Fon.: 09131 / 50654-0   info@intermeta.de
D-91054 Buckenhof     Fax.: 09131 / 50654-20   

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table
  2001-06-08  8:29         ` Henning P. Schmiedehausen
@ 2001-06-08 16:42           ` Alan Cox
  2001-06-08 22:54           ` Albert D. Cahalan
  1 sibling, 0 replies; 51+ messages in thread
From: Alan Cox @ 2001-06-08 16:42 UTC (permalink / raw)
  To: hps; +Cc: linux-kernel

> >Linus opinion on this is irrelevant. Neither I nor the FSF nor many others
> >have released code under anything but the vanilla GPL. By merging such code
> >Linus lost his ability to vary the license.
> 
> Ok, this is a new opinion, because it voids the "using the published
> module ABI is unconditionally ok as stated again and again.

Sorry. I've been stating this since 1994 or so (shortly after Linus made his
comment at the end of the first linux kongress)



^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table
  2001-06-08  8:29         ` Henning P. Schmiedehausen
  2001-06-08 16:42           ` Alan Cox
@ 2001-06-08 22:54           ` Albert D. Cahalan
  2001-06-08 23:46             ` David Woodhouse
  2001-06-11  8:45             ` Henning P. Schmiedehausen
  1 sibling, 2 replies; 51+ messages in thread
From: Albert D. Cahalan @ 2001-06-08 22:54 UTC (permalink / raw)
  To: hps; +Cc: linux-kernel

Henning P. Schmied writes:
> Alan Cox <alan@lxorguk.ukuu.org.uk> writes:

>> So it comes down to the question of whether the module is linking
>> (which is about dependancies and requirements) and what the legal
>> scope is. Which is a matter for lawyers.
>
> And this would void DaveMs' argument, that only the "official in
> Linus' kernel published interface is allowed for binary modules". This
> would mean, that putting the posted, unofficial patch under GPL into
> the kernel and then using this interface for a binary module is just
> the same as using only the official ABI from a lawyers' point of
> view! 
>
> This would make DaveMs' position even less understandable, because
> there would be no difference for a proprietary vendor but keeping the
> patch out of the kernel makes life harder for people like the original
> poster that want to test new (open sourced) protocols like SCTP.

Yep.

Consider a chunk of x86 instructions using a home-grown OS
abstraction layer, and drivers that implement that layer for
both Linux and any non-GPL operating system. The binary blob
is obviously not derived from Linux, and may in fact run
without modification in a BSD or Solaris/x86 kernel.

There is in fact just such a layer. It might not currently
have the features needed to implement TCP, but it could be
extended as needed.




^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table
  2001-06-08 22:54           ` Albert D. Cahalan
@ 2001-06-08 23:46             ` David Woodhouse
  2001-06-11  8:45             ` Henning P. Schmiedehausen
  1 sibling, 0 replies; 51+ messages in thread
From: David Woodhouse @ 2001-06-08 23:46 UTC (permalink / raw)
  To: Albert D. Cahalan; +Cc: hps, linux-kernel


acahalan@cs.uml.edu said:
>  Consider a chunk of x86 instructions using a home-grown OS
> abstraction layer, and drivers that implement that layer for both
> Linux and any non-GPL operating system. The binary blob is obviously
> not derived from Linux, and may in fact run without modification in a
> BSD or Solaris/x86 kernel.

> There is in fact just such a layer. It might not currently have the
> features needed to implement TCP, but it could be extended as needed.

Sounds like you're talking about UDI. I thought that had died the horrible
slow death it deserved - only to be dusted off, redone in CPU-agnostic
bytecode and called ACPI.

--
dwmw2



^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregistertable
  2001-06-07 15:51             ` Mike Galbraith
@ 2001-06-09 22:09               ` watermodem
  2001-06-09 23:15                 ` Alexander Viro
                                   ` (2 more replies)
  0 siblings, 3 replies; 51+ messages in thread
From: watermodem @ 2001-06-09 22:09 UTC (permalink / raw)
  To: Mike Galbraith; +Cc: linux-kernel

Mike Galbraith wrote:
> 
> On Thu, 7 Jun 2001, watermodem wrote:
> 
> > "David S. Miller" wrote:
> > >
> > > George Bonser writes:
> > >  > There is, of course, one basic problem with that argument. While you can say
> > >  > (and probably rightly so) that such a change would not be included in Linus'
> > >  > kernel, I think anyone is allowed to post a patch that might make it
> > >  > possible to add protocols as modules. If anyone chooses to use it is each
> > >  > individual's decision but you could not prevent ACME from creating a patch
> > >  > that allows protocol modules as long as they distributed the patch. Also,  I
> > >  > know that you are allowed to distribute proprietary modules in binary form
> > >  > but are there any restrictions on what function these modules can perform?
> > >  > I don't remember seeing any such restrictions.
> > >
> > > People can post whatever patches which do whatever, sure.
> > > But this isn't what matters.
> > >
> > > What matters is the API under which a binary-only module may interface
> > > to the kernel.  Linus specifies that only the module exports in his
> > > tree fall into this API.
> > >
> > > As I stated in another email, the allowance of binary-only kernel
> > > modules is a special exception to the licensing of the kernel made by
> > > Linus.  The GPL by itself, does not allow this at all.
> > >
> > > Later,
> > > David S. Miller
> > > davem@redhat.com
> >
> > David,
> >
> >    What is your real problem with La Monte's Code.
> >    I don't buy your more "blessed than thou" argument.
> >    It is a typical response one normally sees in large
> >    organizations from folk with "empires" to protect.
> >    Coming from the "land of warring tribes" firm it is
> >    a attitude I have seen often.  My response is take
> >    a vacation, chill out and reassess.
> 
> What words would you like to put in his mouth to replace those he used?
> 
>         -Mike
No words.....  Just suggesting to calm down for awhile before getting
into a flame-war.  I am old enough to know that nothing is lost by
considering your words before painting yourself into a corner you may
not want to occupy in the future.

He is discussing a theme with legal implications. (Legal and Slow tended
to be intertwined)  I know what his position in the linux kernel
hierarchy is, and if he were in a corporation with that position he
could just say NO without any reason.  But, linux development is
portrayed as something "open" and "of the people" not a closed corporate
offering.  Now, if that is not the case, then just take out all the
flowery words from the license and replace it with the unstated but
defacto communist motto "What's mine is mine What's yours is mine!". 
Then you have the Communist Linux vs the Capitalist M$.  Definitely
polarizes issues but doesn't buy anything with folks who just want to
run a stable computer and not make it a political statement.


> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregistertable
  2001-06-09 22:09               ` [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregistertable watermodem
@ 2001-06-09 23:15                 ` Alexander Viro
  2001-06-10  2:59                 ` Horst von Brand
  2001-06-10  4:38                 ` Mike Galbraith
  2 siblings, 0 replies; 51+ messages in thread
From: Alexander Viro @ 2001-06-09 23:15 UTC (permalink / raw)
  To: watermodem; +Cc: Mike Galbraith, linux-kernel



On Sat, 9 Jun 2001, watermodem wrote:

> He is discussing a theme with legal implications. (Legal and Slow tended
> to be intertwined)  I know what his position in the linux kernel
> hierarchy is, and if he were in a corporation with that position he
> could just say NO without any reason.  But, linux development is
> portrayed as something "open" and "of the people" not a closed corporate
> offering.  Now, if that is not the case, then just take out all the
> flowery words from the license and replace it with the unstated but
> defacto communist motto "What's mine is mine What's yours is mine!". 

Pot. Kettle. Black.  You are one who tries to tell other people what
can be done with their code.  With all my personal dislike of GPL
(I use it if the project I'm working on does, but I won't use it
for anything else), Dave _has_ right to choose the license he likes
and you'd bloody better respect that.  Author has absolute right
to set the conditions for using his thing.  If they are unacceptable
for you - nobody forces you to use it.  Any whining about that places
you on the level of Napster wankers.  Now, bugger off - go play with
"social hackers" or something...


^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregistertable
  2001-06-09 22:09               ` [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregistertable watermodem
  2001-06-09 23:15                 ` Alexander Viro
@ 2001-06-10  2:59                 ` Horst von Brand
  2001-06-10  4:38                 ` Mike Galbraith
  2 siblings, 0 replies; 51+ messages in thread
From: Horst von Brand @ 2001-06-10  2:59 UTC (permalink / raw)
  To: watermodem; +Cc: Mike Galbraith, linux-kernel

watermodem <aquamodem@ameritech.net> said:

[...]

> He is discussing a theme with legal implications. (Legal and Slow tended
> to be intertwined)  I know what his position in the linux kernel
> hierarchy is, and if he were in a corporation with that position he
> could just say NO without any reason.  But, linux development is
> portrayed as something "open" and "of the people" not a closed corporate
> offering.  Now, if that is not the case, then just take out all the
> flowery words from the license and replace it with the unstated but
> defacto communist motto "What's mine is mine What's yours is mine!". 
> Then you have the Communist Linux vs the Capitalist M$.  Definitely
> polarizes issues but doesn't buy anything with folks who just want to
> run a stable computer and not make it a political statement.

I just don't understand what would give anybody the right to stuff any
random junk into the official kernel "because it would be convenient for
us", not respecting the view on the matter of the people who wrote it and
so own the copyright to it in the end. If said "right" isn't granted, you
go ahead and accuse them of being "comunists" wanting to take away your
stuff as theirs when it is *exactly* the other way around...

The licence on the kernel certainly gives you (or anybody else) the right
to fork the kernel and make a "protocols are modules" version. Wish you
luck getting it to be used by somebody else, and getting the help of the
people in the know on fixing it when it breaks.
-- 
Horst von Brand                             vonbrand@sleipnir.valparaiso.cl
Casilla 9G, Vin~a del Mar, Chile                               +56 32 672616

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregistertable
  2001-06-09 22:09               ` [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregistertable watermodem
  2001-06-09 23:15                 ` Alexander Viro
  2001-06-10  2:59                 ` Horst von Brand
@ 2001-06-10  4:38                 ` Mike Galbraith
  2 siblings, 0 replies; 51+ messages in thread
From: Mike Galbraith @ 2001-06-10  4:38 UTC (permalink / raw)
  To: watermodem; +Cc: linux-kernel

On Sat, 9 Jun 2001, watermodem wrote:

> Mike Galbraith wrote:
> >
> > On Thu, 7 Jun 2001, watermodem wrote:
> >
> > > "David S. Miller" wrote:
> > > >
> > > > George Bonser writes:
> > > >  > There is, of course, one basic problem with that argument. While you can say
> > > >  > (and probably rightly so) that such a change would not be included in Linus'
> > > >  > kernel, I think anyone is allowed to post a patch that might make it
> > > >  > possible to add protocols as modules. If anyone chooses to use it is each
> > > >  > individual's decision but you could not prevent ACME from creating a patch
> > > >  > that allows protocol modules as long as they distributed the patch. Also,  I
> > > >  > know that you are allowed to distribute proprietary modules in binary form
> > > >  > but are there any restrictions on what function these modules can perform?
> > > >  > I don't remember seeing any such restrictions.
> > > >
> > > > People can post whatever patches which do whatever, sure.
> > > > But this isn't what matters.
> > > >
> > > > What matters is the API under which a binary-only module may interface
> > > > to the kernel.  Linus specifies that only the module exports in his
> > > > tree fall into this API.
> > > >
> > > > As I stated in another email, the allowance of binary-only kernel
> > > > modules is a special exception to the licensing of the kernel made by
> > > > Linus.  The GPL by itself, does not allow this at all.
> > > >
> > > > Later,
> > > > David S. Miller
> > > > davem@redhat.com
> > >
> > > David,
> > >
> > >    What is your real problem with La Monte's Code.
> > >    I don't buy your more "blessed than thou" argument.
> > >    It is a typical response one normally sees in large
> > >    organizations from folk with "empires" to protect.
> > >    Coming from the "land of warring tribes" firm it is
> > >    a attitude I have seen often.  My response is take
> > >    a vacation, chill out and reassess.
> >
> > What words would you like to put in his mouth to replace those he used?
> >
> >         -Mike
> No words.....  Just suggesting to calm down for awhile before getting
> into a flame-war.  I am old enough to know that nothing is lost by
> considering your words before painting yourself into a corner you may
> not want to occupy in the future.

There is a rather amusing contradiction present in these new words..
your first words were ill chosen to the point of being offensive.

I've said what I had to say, so consider yourself flamed.

	-Mike


^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table
  2001-06-08 22:54           ` Albert D. Cahalan
  2001-06-08 23:46             ` David Woodhouse
@ 2001-06-11  8:45             ` Henning P. Schmiedehausen
  2001-06-11  9:43               ` Helge Hafting
  2001-06-11 16:17               ` Alan Cox
  1 sibling, 2 replies; 51+ messages in thread
From: Henning P. Schmiedehausen @ 2001-06-11  8:45 UTC (permalink / raw)
  To: linux-kernel

"Albert D. Cahalan" <acahalan@cs.uml.edu> writes:

>Yep.

>Consider a chunk of x86 instructions using a home-grown OS
>abstraction layer, and drivers that implement that layer for
>both Linux and any non-GPL operating system. The binary blob
>is obviously not derived from Linux, and may in fact run
>without modification in a BSD or Solaris/x86 kernel.

I had an interesting discussion with my brother-in-law at this
weekend: What is source code?

In my (very much younger days), I used to hack in 8085 and Z80
assembler and even hex codes directly onto the disk / files using all
those scary tools like DDT and M80/L80 under CP/M (those were the days
when Microsoft tools were really bleeding edge. ;-) )

What if there is really a warbled indivdual that can write a driver in
object code? Or at least in x86 assembler and then performs the magic
necessary to link it into the kernel?

Is this a "binary only" driver or just a driver on par with the NVidia
that is just "GPL'ed but unreadable"?

	Regards
		Henning


-- 
Henning Schmiedehausen     "They took the credit for your second symphony. 
hps@intermeta.de            Rewritten by machine and "New Technology".         
henning@forge.franken.de    and now I understand the problems you can see."
                                                        -- The Buggles, 1979

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table
  2001-06-11  8:45             ` Henning P. Schmiedehausen
@ 2001-06-11  9:43               ` Helge Hafting
  2001-06-11 16:17               ` Alan Cox
  1 sibling, 0 replies; 51+ messages in thread
From: Helge Hafting @ 2001-06-11  9:43 UTC (permalink / raw)
  To: hps; +Cc: linux-kernel

"Henning P. Schmiedehausen" wrote:

> I had an interesting discussion with my brother-in-law at this
> weekend: What is source code?

The GPL covers this, if you're using it:

"The source code for a work means the preferred form of the work for
making modifications to it.  For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable.  However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable."

> What if there is really a warbled indivdual that can write a driver in
> object code? Or at least in x86 assembler and then performs the magic
> necessary to link it into the kernel?

You may of course write a driver/program by "cat > file.o" and end up
with a program with no source.  The gpl says source is 
"the preferred form of the work for making modifications to it."
So this object file does not work with the gpl because object files
is not a preferred form for making modifications.  This could change
if programmers in general change to *prefer* editing .o files  *instead* 
of working with source and compilers.  Winning the lottery every time
is more probable though...
 
Source in any language, even assembly, qualify.  But note the
"preferred form", merely disassembling the object file is
dubious.  So is deliberately obfuscated source.

> Is this a "binary only" driver or just a driver on par with the NVidia
> that is just "GPL'ed but unreadable"?

It is definitely binary only, as there is no source.  That don't
nullify your obligation to provide source though, so you can't
distribute it under the GPL.

Try reading /usr/share/common-licenses/GPL , it isn't that long and
have many answers to such questions.

Helge Hafting

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table
  2001-06-11  8:45             ` Henning P. Schmiedehausen
  2001-06-11  9:43               ` Helge Hafting
@ 2001-06-11 16:17               ` Alan Cox
  2001-06-11 18:31                 ` Jacob Luna Lundberg
  1 sibling, 1 reply; 51+ messages in thread
From: Alan Cox @ 2001-06-11 16:17 UTC (permalink / raw)
  To: hps; +Cc: linux-kernel

> Is this a "binary only" driver or just a driver on par with the NVidia
> that is just "GPL'ed but unreadable"?

There are reasons the GPL carefully defines it

"The source code for a work means the preferred form of the work for
making modifications to it.  For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable."

^ permalink raw reply	[flat|nested] 51+ messages in thread

* [PATCH] sockreg2.4.5-06 inet[6]_create() register/unregister table
  2001-06-05 16:59 ` [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table La Monte H.P. Yarroll
  2001-06-06 22:07   ` La Monte H.P. Yarroll
@ 2001-06-11 18:26   ` La Monte H.P. Yarroll
  2001-06-13 16:25   ` David S. Miller
  2 siblings, 0 replies; 51+ messages in thread
From: La Monte H.P. Yarroll @ 2001-06-11 18:26 UTC (permalink / raw)
  To: davem; +Cc: linux-kernel, sctp-developers-list

Here is the register/unregister inet[6]_create() table patch revised
to disable deregistration and overriding of TCP and UDP.

DESCRIPTION
This patch adds a mechanism for registering new IP transport protocols
for the socket() system call.  It replaces the hard-coded switch
tables in inet_create() and inet6_create() with explicit data
structures.

The new calls are:
void    inet_register_protosw(struct inet_protosw *p);
void    inet_unregister_protosw(struct inet_protosw *p);
void    inet6_register_protosw(struct inet_protosw *p);
void    inet6_unregister_protosw(struct inet_protosw *p);

This is the first of a series of proposed changes to support IP
transport modules.

MOTIVATION
As part of the effort to create the Linux Kernel implementation of
SCTP <www.sourceforge.net/projects/lksctp>, we seek to make it
possible to load a new IP transport protocol as a kernel module.

It is already possible to register new address families.  It is even
possible to register new transport protocols with IP.  However, in
order to be able to open a socket with a new transport protocol, you
must replace the whole AF_INET address family.

In addition to SCTP, there are other protocols which could find it
useful to be in a kernel module. For example, TCP extensions like TCP
framing and TCP over satellite, multicast protocols, and RTP/ROHC
(robust header compression).  In general, support for IP transport
modules makes transport layer experimentation easier.

CHANGES SINCE sockreg2.4.5-05

Due to concerns about permitting non-GPL'd replacements for TCP, we
have added the concept of a "permanent" protocol.  These protocols can 
only be registered once, and then they can not be overridden or
unregistered.

CHANGES SINCE sockreg2.4.3-04

We noticed that inet6_protocol_base went away in 2.4.5, so we changed
our v6 initialization to parallel the inet6_protocol initialization.
We now call inet6_register_protosw() from *v6_init() instead of having
a static array of struct protosw's.  Since other protocols depend on
raw sockets (e.g. ICMP, IGMP, NDISC) we still register rawv6_protosw
in inet6_init().

piggy (La Monte H.P. Yarroll)
Karl O. Knutson

PATCH FOLLOWS
diff -r -u linux-2.4.5-dist/include/asm-alpha/socket.h linux/include/asm-alpha/socket.h
--- linux-2.4.5-dist/include/asm-alpha/socket.h	Sat Feb  3 13:26:44 2001
+++ linux/include/asm-alpha/socket.h	Mon Jun 11 12:14:34 2001
@@ -66,6 +66,7 @@
 					/* level.  For writing rarp and	*/
 					/* other similar things on the	*/
 					/* user level.			*/
+#define	SOCK_MAX	(SOCK_PACKET+1)
 #endif
 
 #endif /* _ASM_SOCKET_H */
diff -r -u linux-2.4.5-dist/include/asm-arm/socket.h linux/include/asm-arm/socket.h
--- linux-2.4.5-dist/include/asm-arm/socket.h	Sat Feb  3 13:26:44 2001
+++ linux/include/asm-arm/socket.h	Mon Jun 11 12:14:34 2001
@@ -58,6 +58,7 @@
 					/* level.  For writing rarp and	*/
 					/* other similar things on the	*/
 					/* user level.			*/
+#define	SOCK_MAX	(SOCK_PACKET+1)
 #endif
 
 #endif /* _ASM_SOCKET_H */
diff -r -u linux-2.4.5-dist/include/asm-cris/socket.h linux/include/asm-cris/socket.h
--- linux-2.4.5-dist/include/asm-cris/socket.h	Fri Apr  6 12:51:19 2001
+++ linux/include/asm-cris/socket.h	Mon Jun 11 12:14:34 2001
@@ -59,6 +59,7 @@
                                         /* level.  For writing rarp and */
                                         /* other similar things on the  */
                                         /* user level.                  */
+#define	SOCK_MAX	(SOCK_PACKET+1)
 #endif
 
 #endif /* _ASM_SOCKET_H */
diff -r -u linux-2.4.5-dist/include/asm-i386/socket.h linux/include/asm-i386/socket.h
--- linux-2.4.5-dist/include/asm-i386/socket.h	Sat Feb  3 13:26:44 2001
+++ linux/include/asm-i386/socket.h	Mon Jun 11 12:14:34 2001
@@ -58,6 +58,7 @@
 					/* level.  For writing rarp and	*/
 					/* other similar things on the	*/
 					/* user level.			*/
+#define	SOCK_MAX	(SOCK_PACKET+1)
 #endif
 
 #endif /* _ASM_SOCKET_H */
diff -r -u linux-2.4.5-dist/include/asm-ia64/socket.h linux/include/asm-ia64/socket.h
--- linux-2.4.5-dist/include/asm-ia64/socket.h	Sat Feb  3 13:26:44 2001
+++ linux/include/asm-ia64/socket.h	Mon Jun 11 12:14:34 2001
@@ -65,6 +65,7 @@
 					/* level.  For writing rarp and	*/
 					/* other similar things on the	*/
 					/* user level.			*/
+#define	SOCK_MAX	(SOCK_PACKET+1)
 #endif
 
 #endif /* _ASM_IA64_SOCKET_H */
diff -r -u linux-2.4.5-dist/include/asm-m68k/socket.h linux/include/asm-m68k/socket.h
--- linux-2.4.5-dist/include/asm-m68k/socket.h	Sat Feb  3 13:26:44 2001
+++ linux/include/asm-m68k/socket.h	Mon Jun 11 12:14:34 2001
@@ -58,6 +58,7 @@
 					/* level.  For writing rarp and	*/
 					/* other similar things on the	*/
 					/* user level.			*/
+#define	SOCK_MAX	(SOCK_PACKET+1)
 #endif
 
 #endif /* _ASM_SOCKET_H */
diff -r -u linux-2.4.5-dist/include/asm-mips/socket.h linux/include/asm-mips/socket.h
--- linux-2.4.5-dist/include/asm-mips/socket.h	Sat Feb  3 13:26:44 2001
+++ linux/include/asm-mips/socket.h	Mon Jun 11 12:14:34 2001
@@ -71,6 +71,7 @@
 					/* level.  For writing rarp and	*/
 					/* other similar things on the	*/
 					/* user level.			*/
+#define	SOCK_MAX	(SOCK_PACKET+1)
 #endif
 
 #endif /* _ASM_SOCKET_H */
diff -r -u linux-2.4.5-dist/include/asm-mips64/socket.h linux/include/asm-mips64/socket.h
--- linux-2.4.5-dist/include/asm-mips64/socket.h	Sat Feb  3 13:26:44 2001
+++ linux/include/asm-mips64/socket.h	Mon Jun 11 12:14:34 2001
@@ -79,6 +79,7 @@
 					/* level.  For writing rarp and	*/
 					/* other similar things on the	*/
 					/* user level.			*/
+#define	SOCK_MAX	(SOCK_PACKET+1)
 #endif
 
 #endif /* _ASM_SOCKET_H */
diff -r -u linux-2.4.5-dist/include/asm-parisc/socket.h linux/include/asm-parisc/socket.h
--- linux-2.4.5-dist/include/asm-parisc/socket.h	Sat Feb  3 13:26:44 2001
+++ linux/include/asm-parisc/socket.h	Mon Jun 11 12:14:34 2001
@@ -56,6 +56,7 @@
 				/* level.  For writing rarp and	*/
 				/* other similar things on the	*/
 				/* user level.			*/
+#define	SOCK_MAX	(SOCK_PACKET+1)
 #endif
 
 #endif /* _ASM_SOCKET_H */
diff -r -u linux-2.4.5-dist/include/asm-ppc/socket.h linux/include/asm-ppc/socket.h
--- linux-2.4.5-dist/include/asm-ppc/socket.h	Mon May 21 17:02:06 2001
+++ linux/include/asm-ppc/socket.h	Mon Jun 11 12:14:34 2001
@@ -67,6 +67,7 @@
 					/* level.  For writing rarp and	*/
 					/* other similar things on the	*/
 					/* user level.			*/
+#define	SOCK_MAX	(SOCK_PACKET+1)
 #endif
 
 #endif /* _ASM_SOCKET_H */
diff -r -u linux-2.4.5-dist/include/asm-s390/socket.h linux/include/asm-s390/socket.h
--- linux-2.4.5-dist/include/asm-s390/socket.h	Sat Feb  3 13:26:44 2001
+++ linux/include/asm-s390/socket.h	Mon Jun 11 12:14:34 2001
@@ -66,6 +66,7 @@
 					/* level.  For writing rarp and	*/
 					/* other similar things on the	*/
 					/* user level.			*/
+#define	SOCK_MAX	(SOCK_PACKET+1)
 #endif
 
 #endif /* _ASM_SOCKET_H */
diff -r -u linux-2.4.5-dist/include/asm-s390x/socket.h linux/include/asm-s390x/socket.h
--- linux-2.4.5-dist/include/asm-s390x/socket.h	Fri Mar  2 13:12:06 2001
+++ linux/include/asm-s390x/socket.h	Mon Jun 11 12:14:34 2001
@@ -65,6 +65,7 @@
 					/* level.  For writing rarp and	*/
 					/* other similar things on the	*/
 					/* user level.			*/
+#define	SOCK_MAX	(SOCK_PACKET+1)
 #endif
 
 #endif /* _ASM_SOCKET_H */
diff -r -u linux-2.4.5-dist/include/asm-sh/socket.h linux/include/asm-sh/socket.h
--- linux-2.4.5-dist/include/asm-sh/socket.h	Sat Feb  3 13:26:44 2001
+++ linux/include/asm-sh/socket.h	Mon Jun 11 12:14:34 2001
@@ -58,6 +58,7 @@
 					/* level.  For writing rarp and	*/
 					/* other similar things on the	*/
 					/* user level.			*/
+#define	SOCK_MAX	(SOCK_PACKET+1)
 #endif
 
 #endif /* __ASM_SH_SOCKET_H */
diff -r -u linux-2.4.5-dist/include/asm-sparc/socket.h linux/include/asm-sparc/socket.h
--- linux-2.4.5-dist/include/asm-sparc/socket.h	Sat Feb  3 13:26:44 2001
+++ linux/include/asm-sparc/socket.h	Mon Jun 11 12:14:34 2001
@@ -63,6 +63,7 @@
 					/* level.  For writing rarp and	*/
 					/* other similar things on the	*/
 					/* user level.			*/
+#define	SOCK_MAX	(SOCK_PACKET+1)
 #endif
 
 #endif /* _ASM_SOCKET_H */
diff -r -u linux-2.4.5-dist/include/asm-sparc64/socket.h linux/include/asm-sparc64/socket.h
--- linux-2.4.5-dist/include/asm-sparc64/socket.h	Sat Feb  3 13:26:44 2001
+++ linux/include/asm-sparc64/socket.h	Mon Jun 11 12:14:34 2001
@@ -63,6 +63,7 @@
 					/* level.  For writing rarp and	*/
 					/* other similar things on the	*/
 					/* user level.			*/
+#define	SOCK_MAX	(SOCK_PACKET+1)
 #endif
 
 #endif /* _ASM_SOCKET_H */
diff -r -u linux-2.4.5-dist/include/net/protocol.h linux/include/net/protocol.h
--- linux-2.4.5-dist/include/net/protocol.h	Fri May 25 20:01:27 2001
+++ linux/include/net/protocol.h	Mon Jun 11 12:56:56 2001
@@ -63,19 +63,46 @@
 
 #endif
 
+/* This is used to register socket interfaces for IP protocols.  */
+struct inet_protosw {
+	struct list_head list;
+
+        /* These two fields form the lookup key.  */
+	unsigned short	 type;	   /* This is the 2nd argument to socket(2). */
+	int		 protocol; /* This is the L4 protocol number.  */
+
+	struct proto	 *prot;
+	struct proto_ops *ops;
+  
+	int              capability; /* Which (if any) capability do
+				      * we need to use this socket
+				      * interface?
+                                      */
+	char             no_check;   /* checksum on rcv/xmit/none? */
+	unsigned char	 flags;      /* See INET_PROTOSW_* below.  */
+};
+#define INET_PROTOSW_REUSE 0x01	     /* Are ports automatically reusable? */
+#define INET_PROTOSW_PERMANENT 0x02  /* Permanent protocols are unremovable. */
+
 extern struct inet_protocol *inet_protocol_base;
 extern struct inet_protocol *inet_protos[MAX_INET_PROTOS];
+extern struct list_head inetsw[SOCK_MAX];
 
 #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
 extern struct inet6_protocol *inet6_protos[MAX_INET_PROTOS];
+extern struct list_head inetsw6[SOCK_MAX];
 #endif
 
 extern void	inet_add_protocol(struct inet_protocol *prot);
 extern int	inet_del_protocol(struct inet_protocol *prot);
+extern void	inet_register_protosw(struct inet_protosw *p);
+extern void	inet_unregister_protosw(struct inet_protosw *p);
 
 #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
 extern void	inet6_add_protocol(struct inet6_protocol *prot);
 extern int	inet6_del_protocol(struct inet6_protocol *prot);
+extern void	inet6_register_protosw(struct inet_protosw *p);
+extern void	inet6_unregister_protosw(struct inet_protosw *p);
 #endif
 
 #endif	/* _PROTOCOL_H */
diff -r -u linux-2.4.5-dist/net/ipv4/af_inet.c linux/net/ipv4/af_inet.c
--- linux-2.4.5-dist/net/ipv4/af_inet.c	Tue May  1 22:59:24 2001
+++ linux/net/ipv4/af_inet.c	Mon Jun 11 12:47:29 2001
@@ -14,6 +14,8 @@
  *
  * Changes (see also sock.c)
  *
+ *		piggy,
+ *		Karl Knutson	:	Socket protocol table
  *		A.N.Kuznetsov	:	Socket death error in accept().
  *		John Richardson :	Fix non blocking error in connect()
  *					so sockets that fail to connect
@@ -88,6 +90,7 @@
 #include <linux/smp_lock.h>
 #include <linux/inet.h>
 #include <linux/netdevice.h>
+#include <linux/brlock.h>
 #include <net/ip.h>
 #include <net/protocol.h>
 #include <net/arp.h>
@@ -142,6 +145,11 @@
 int (*br_ioctl_hook)(unsigned long);
 #endif
 
+/* The inetsw table contains everything that inet_create needs to
+ * build a new socket.
+ */
+struct list_head inetsw[SOCK_MAX];
+
 /* New destruction routine */
 
 void inet_sock_destruct(struct sock *sk)
@@ -309,46 +317,56 @@
 static int inet_create(struct socket *sock, int protocol)
 {
 	struct sock *sk;
-	struct proto *prot;
+        struct list_head *p;
+        struct inet_protosw *answer;
 
 	sock->state = SS_UNCONNECTED;
 	sk = sk_alloc(PF_INET, GFP_KERNEL, 1);
 	if (sk == NULL) 
 		goto do_oom;
-
-	switch (sock->type) {
-	case SOCK_STREAM:
-		if (protocol && protocol != IPPROTO_TCP)
-			goto free_and_noproto;
-		protocol = IPPROTO_TCP;
-		prot = &tcp_prot;
-		sock->ops = &inet_stream_ops;
-		break;
-	case SOCK_SEQPACKET:
-		goto free_and_badtype;
-	case SOCK_DGRAM:
-		if (protocol && protocol != IPPROTO_UDP)
-			goto free_and_noproto;
-		protocol = IPPROTO_UDP;
-		sk->no_check = UDP_CSUM_DEFAULT;
-		prot=&udp_prot;
-		sock->ops = &inet_dgram_ops;
-		break;
-	case SOCK_RAW:
-		if (!capable(CAP_NET_RAW))
-			goto free_and_badperm;
-		if (!protocol)
-			goto free_and_noproto;
-		prot = &raw_prot;
-		sk->reuse = 1;
-		sk->num = protocol;
-		sock->ops = &inet_dgram_ops;
-		if (protocol == IPPROTO_RAW)
-			sk->protinfo.af_inet.hdrincl = 1;
-		break;
-	default:
-		goto free_and_badtype;
-	}
+  
+        /* Look for the requested type/protocol pair.  */
+        answer = NULL;
+  	br_read_lock_bh(BR_NETPROTO_LOCK);
+        list_for_each(p, &inetsw[sock->type]) {
+                answer = list_entry(p, struct inet_protosw, list);
+                /* Check the non-wild match.  */
+                if (protocol == answer->protocol) {
+                        if (protocol != IPPROTO_IP) {
+                                break;
+                        }
+                } else {
+                        /* Check for the two wild cases. */
+                        if (IPPROTO_IP == protocol) {
+                                protocol = answer->protocol;
+                                break;
+                        }
+                        if (IPPROTO_IP == answer->protocol) {
+                                break;
+                        }
+                }
+                answer = NULL;
+        }
+  	br_read_unlock_bh(BR_NETPROTO_LOCK);
+
+        if (!answer)
+                goto free_and_badtype;
+        if (answer->capability > 0 && !capable(answer->capability))
+                goto free_and_badperm;
+        if (!protocol)
+                goto free_and_noproto;
+
+        sock->ops = answer->ops;
+        sk->prot = answer->prot;
+        sk->no_check = answer->no_check;
+        if (INET_PROTOSW_REUSE & answer->flags)
+                sk->reuse = 1;
+
+        if (SOCK_RAW == sock->type) {
+                sk->num = protocol;
+                if (IPPROTO_RAW == protocol)
+                        sk->protinfo.af_inet.hdrincl = 1;
+        }
 
 	if (ipv4_config.no_pmtu_disc)
 		sk->protinfo.af_inet.pmtudisc = IP_PMTUDISC_DONT;
@@ -365,8 +383,7 @@
 	sk->family	= PF_INET;
 	sk->protocol	= protocol;
 
-	sk->prot	= prot;
-	sk->backlog_rcv = prot->backlog_rcv;
+	sk->backlog_rcv = sk->prot->backlog_rcv;
 
 	sk->protinfo.af_inet.ttl	= sysctl_ip_default_ttl;
 
@@ -969,6 +986,106 @@
 extern void tcp_init(void);
 extern void tcp_v4_init(struct net_proto_family *);
 
+/* Upon startup we insert all the elements in inetsw_array[] into
+ * the linked list inetsw.
+ */
+static struct inet_protosw inetsw_array[] =
+{
+        {
+                type:        SOCK_STREAM,
+                protocol:    IPPROTO_TCP,
+                prot:        &tcp_prot,
+                ops:         &inet_stream_ops,
+                capability:  -1,
+                no_check:    0,
+                flags:       INET_PROTOSW_PERMANENT,
+        },
+
+        {
+                type:        SOCK_DGRAM,
+                protocol:    IPPROTO_UDP,
+                prot:        &udp_prot,
+                ops:         &inet_dgram_ops,
+                capability:  -1,
+                no_check:    UDP_CSUM_DEFAULT,
+                flags:       INET_PROTOSW_PERMANENT,
+       },
+        
+
+       {
+               type:        SOCK_RAW,
+               protocol:    IPPROTO_IP,	/* wild card */
+               prot:        &raw_prot,
+               ops:         &inet_dgram_ops,
+               capability:  CAP_NET_RAW,
+               no_check:    UDP_CSUM_DEFAULT,
+               flags:       INET_PROTOSW_REUSE,
+       }
+}; /* struct inet_protosw inetsw_array[] */
+
+#define INETSW_ARRAY_LEN (sizeof(inetsw_array) / sizeof(struct inet_protosw))
+
+void
+inet_register_protosw(struct inet_protosw *p)
+{
+        struct list_head *lh;
+        struct inet_protosw *answer;
+        int protocol = p->protocol;
+
+        br_write_lock_bh(BR_NETPROTO_LOCK);
+
+        if (p->type > SOCK_MAX) {
+                goto out_illegal;
+        }
+
+        /* If we are trying to override a permanent protocol, bail.  */
+        answer = NULL;
+        list_for_each(lh, &inetsw[p->type]) {
+                answer = list_entry(lh, struct inet_protosw, list);
+                /* Check only the non-wild match.  */
+                if (protocol == answer->protocol
+                    && (INET_PROTOSW_PERMANENT & answer->flags)) {
+                        break;
+                }
+                answer = NULL;
+        }
+        if (answer)
+                goto out_permanent;
+
+	/* Add to the BEGINNING so that we override any existing
+	 * entry.  This means that when we remove this entry, the
+	 * system automatically returns to the old behavior.
+	 */
+        list_add(&p->list, &inetsw[p->type]);
+ out:
+        br_write_unlock_bh(BR_NETPROTO_LOCK);
+        return;
+
+ out_permanent:
+        printk(KERN_ERR "Attempt to override permanent protocol %d.\n",
+               protocol);
+        goto out;
+ out_illegal:
+        printk(KERN_ERR
+               "Ignoring attempt to register illegal socket type %d.\n",
+               p->type);
+        goto out;
+} /* inet_register_protosw() */
+
+void
+inet_unregister_protosw(struct inet_protosw *p)
+{
+        if (INET_PROTOSW_PERMANENT & p->flags) {
+                printk(KERN_ERR
+                       "Attempt to unregister permanent protocol %d.\n",
+                       p->protocol);
+        } else {
+                br_write_lock_bh(BR_NETPROTO_LOCK);
+                list_del(&p->list);
+                br_write_unlock_bh(BR_NETPROTO_LOCK);
+        }
+} /* inet_unregister_protosw() */
+
 
 /*
  *	Called by socket.c on kernel startup.  
@@ -978,6 +1095,8 @@
 {
 	struct sk_buff *dummy_skb;
 	struct inet_protocol *p;
+	struct inet_protosw *q;
+        struct list_head *r;
 
 	printk(KERN_INFO "NET4: Linux TCP/IP 1.0 for NET4.0\n");
 
@@ -1003,6 +1122,14 @@
 		printk("%s%s",p->name,tmp?", ":"\n");
 		p = tmp;
 	}
+
+        /* Register the socket-side information for inet_create.  */
+        for(r = &inetsw[0]; r < &inetsw[SOCK_MAX]; ++r) {
+                INIT_LIST_HEAD(r);
+        }
+        for(q = inetsw_array; q < &inetsw_array[INETSW_ARRAY_LEN]; ++q) {
+                inet_register_protosw(q);
+        }
 
 	/*
 	 *	Set the ARP module up
diff -r -u linux-2.4.5-dist/net/ipv6/af_inet6.c linux/net/ipv6/af_inet6.c
--- linux-2.4.5-dist/net/ipv6/af_inet6.c	Thu Apr 12 14:11:39 2001
+++ linux/net/ipv6/af_inet6.c	Mon Jun 11 12:47:41 2001
@@ -10,6 +10,7 @@
  *	$Id: af_inet6.c,v 1.63 2001/03/02 03:13:05 davem Exp $
  *
  * 	Fixes:
+ *	piggy, Karl Knutson	:	Socket protocol table
  * 	Hideaki YOSHIFUJI	:	sin6_scope_id support
  * 	Arnaldo Melo		: 	check proc_net_create return, cleanups
  *
@@ -44,6 +45,7 @@
 #include <linux/inet.h>
 #include <linux/netdevice.h>
 #include <linux/icmpv6.h>
+#include <linux/brlock.h>
 #include <linux/smp_lock.h>
 
 #include <net/ip.h>
@@ -71,9 +73,6 @@
 MODULE_PARM(unloadable, "i");
 #endif
 
-extern struct proto_ops inet6_stream_ops;
-extern struct proto_ops inet6_dgram_ops;
-
 /* IPv6 procfs goodies... */
 
 #ifdef CONFIG_PROC_FS
@@ -93,6 +92,11 @@
 atomic_t inet6_sock_nr;
 #endif
 
+/* The inetsw table contains everything that inet_create needs to
+ * build a new socket.
+ */
+struct list_head inetsw6[SOCK_MAX];
+
 static void inet6_sock_destruct(struct sock *sk)
 {
 	inet_sock_destruct(sk);
@@ -106,47 +110,64 @@
 static int inet6_create(struct socket *sock, int protocol)
 {
 	struct sock *sk;
-	struct proto *prot;
+        struct list_head *p;
+        struct inet_protosw *answer;
 
 	sk = sk_alloc(PF_INET6, GFP_KERNEL, 1);
 	if (sk == NULL) 
 		goto do_oom;
 
-	if(sock->type == SOCK_STREAM || sock->type == SOCK_SEQPACKET) {
-		if (protocol && protocol != IPPROTO_TCP) 
-			goto free_and_noproto;
-		protocol = IPPROTO_TCP;
-		prot = &tcpv6_prot;
-		sock->ops = &inet6_stream_ops;
-	} else if(sock->type == SOCK_DGRAM) {
-		if (protocol && protocol != IPPROTO_UDP) 
-			goto free_and_noproto;
-		protocol = IPPROTO_UDP;
-		sk->no_check = UDP_CSUM_DEFAULT;
-		prot=&udpv6_prot;
-		sock->ops = &inet6_dgram_ops;
-	} else if(sock->type == SOCK_RAW) {
-		if (!capable(CAP_NET_RAW))
-			goto free_and_badperm;
-		if (!protocol) 
-			goto free_and_noproto;
-		prot = &rawv6_prot;
-		sock->ops = &inet6_dgram_ops;
-		sk->reuse = 1;
-		sk->num = protocol;
-	} else {
-		goto free_and_badtype;
-	}
-	
+        /* Look for the requested type/protocol pair.  */
+        answer = NULL;
+	br_read_lock_bh(BR_NETPROTO_LOCK);
+        list_for_each(p, &inetsw6[sock->type]) {
+                answer = list_entry(p, struct inet_protosw, list);
+                /* Check the non-wild match.  */
+                if (protocol == answer->protocol) {
+                        if (protocol != IPPROTO_IP) {
+                                break;
+                        }
+                } else {
+                        /* Check for the two wild cases. */
+                        if (IPPROTO_IP == protocol) {
+                                protocol = answer->protocol;
+                                break;
+                        }
+                        if (IPPROTO_IP == answer->protocol) {
+                                break;
+                        }
+                }
+                answer = NULL;
+        }
+	br_read_unlock_bh(BR_NETPROTO_LOCK);
+
+        if (!answer)
+                goto free_and_badtype;
+        if (answer->capability > 0 && !capable(answer->capability))
+                goto free_and_badperm;
+        if (!protocol)
+                goto free_and_noproto;
+
+        sock->ops = answer->ops;
 	sock_init_data(sock, sk);
 
+	sk->prot		= answer->prot;
+        sk->no_check = answer->no_check;
+        if (INET_PROTOSW_REUSE & answer->flags)
+                sk->reuse = 1;
+
+        if (SOCK_RAW == sock->type) {
+                sk->num = protocol;
+                if (IPPROTO_RAW == protocol)
+                        sk->protinfo.af_inet.hdrincl = 1;
+        }
+
 	sk->destruct            = inet6_sock_destruct;
 	sk->zapped		= 0;
 	sk->family		= PF_INET6;
 	sk->protocol		= protocol;
 
-	sk->prot		= prot;
-	sk->backlog_rcv		= prot->backlog_rcv;
+	sk->backlog_rcv		= answer->prot->backlog_rcv;
 
 	sk->net_pinfo.af_inet6.hop_limit  = -1;
 	sk->net_pinfo.af_inet6.mcast_hops = -1;
@@ -175,9 +196,6 @@
 #endif
 	MOD_INC_USE_COUNT;
 
-	if (sk->type==SOCK_RAW && protocol==IPPROTO_RAW)
-		sk->protinfo.af_inet.hdrincl=1;
-
 	if (sk->num) {
 		/* It assumes that any protocol which allows
 		 * the user to assign a number at socket
@@ -186,7 +204,6 @@
 		sk->sport = ntohs(sk->num);
 		sk->prot->hash(sk);
 	}
-
 	if (sk->prot->init) {
 		int err = sk->prot->init(sk);
 		if (err != 0) {
@@ -504,9 +521,75 @@
 extern void ipv6_sysctl_unregister(void);
 #endif
 
+static struct inet_protosw rawv6_protosw = {
+        type:        SOCK_RAW,
+        protocol:    IPPROTO_IP,	/* wild card */
+        prot:        &rawv6_prot,
+        ops:         &inet6_dgram_ops,
+        capability:  CAP_NET_RAW,
+        no_check:    UDP_CSUM_DEFAULT,
+        flags:       INET_PROTOSW_REUSE,
+};
+
+#define INETSW6_ARRAY_LEN (sizeof(inetsw6_array) / sizeof(struct inet_protosw))
+
+void
+inet6_register_protosw(struct inet_protosw *p)
+{
+        struct list_head *lh;
+        struct inet_protosw *answer;
+        int protocol = p->protocol;
+
+        br_write_lock_bh(BR_NETPROTO_LOCK);
+
+        if (p->type > SOCK_MAX) {
+                goto out_illegal;
+        }
+
+        /* If we are trying to override a permanent protocol, bail.  */
+        answer = NULL;
+        list_for_each(lh, &inetsw6[p->type]) {
+                answer = list_entry(lh, struct inet_protosw, list);
+                /* Check only the non-wild match.  */
+                if (protocol == answer->protocol
+                    && (INET_PROTOSW_PERMANENT & answer->flags)) {
+                        break;
+                }
+                answer = NULL;
+        }
+        if (answer)
+                goto out_permanent;
+
+	/* Add to the BEGINNING so that we override any existing
+	 * entry.  This means that when we remove this entry, the
+	 * system automatically returns to the old behavior.
+	 */
+        list_add(&p->list, &inetsw6[p->type]);
+ out:
+        br_write_unlock_bh(BR_NETPROTO_LOCK);
+        return;
+
+ out_permanent:
+        printk(KERN_ERR "Attempt to override permanent protocol %d.\n",
+               protocol);
+        goto out;
+ out_illegal:
+        printk(KERN_ERR
+               "Ignoring attempt to register illegal socket type %d.\n",
+               p->type);
+        goto out;
+} /* inet6_register_protosw() */
+
+void
+inet6_unregister_protosw(struct inet_protosw *p)
+{
+        inet_unregister_protosw(p);
+} /* inet6_unregister_protosw() */
+
 static int __init inet6_init(void)
 {
 	struct sk_buff *dummy_skb;
+        struct list_head *r;
 	int err;
 
 #ifdef MODULE
@@ -523,6 +606,16 @@
 		printk(KERN_CRIT "inet6_proto_init: size fault\n");
 		return -EINVAL;
 	}
+
+        /* Register the socket-side information for inet6_create.  */
+        for(r = &inetsw6[0]; r < &inetsw6[SOCK_MAX]; ++r) {
+                INIT_LIST_HEAD(r);
+        }
+
+        /* We MUST register RAW sockets before we create the ICMP6,
+         * IGMP6, or NDISC control sockets.
+         */
+        inet6_register_protosw(&rawv6_protosw);
 
 	/*
 	 *	ipngwg API draft makes clear that the correct semantics
diff -r -u linux-2.4.5-dist/net/ipv6/tcp_ipv6.c linux/net/ipv6/tcp_ipv6.c
--- linux-2.4.5-dist/net/ipv6/tcp_ipv6.c	Wed Apr 25 16:57:39 2001
+++ linux/net/ipv6/tcp_ipv6.c	Mon Jun 11 12:14:34 2001
@@ -2125,8 +2125,21 @@
 	"TCPv6"			/* name			*/
 };
 
+extern struct proto_ops inet6_stream_ops;
+
+static struct inet_protosw tcpv6_protosw = {
+        type:        SOCK_STREAM,
+        protocol:    IPPROTO_TCP,
+        prot:        &tcpv6_prot,
+        ops:         &inet6_stream_ops,
+        capability:  -1,
+        no_check:    0,
+        flags:       INET_PROTOSW_PERMANENT,
+};
+
 void __init tcpv6_init(void)
 {
 	/* register inet6 protocol */
 	inet6_add_protocol(&tcpv6_protocol);
+        inet6_register_protosw(&tcpv6_protosw);
 }
diff -r -u linux-2.4.5-dist/net/ipv6/udp.c linux/net/ipv6/udp.c
--- linux-2.4.5-dist/net/ipv6/udp.c	Thu Apr 12 14:11:39 2001
+++ linux/net/ipv6/udp.c	Mon Jun 11 12:58:40 2001
@@ -992,7 +992,21 @@
 	get_port:	udp_v6_get_port,
 };
 
+extern struct proto_ops inet6_dgram_ops;
+
+static struct inet_protosw udpv6_protosw = {
+        type:        SOCK_DGRAM,
+        protocol:    IPPROTO_UDP,
+        prot:        &udpv6_prot,
+        ops:         &inet6_dgram_ops,
+        capability:  -1,
+        no_check:    UDP_CSUM_DEFAULT,
+        flags:       INET_PROTOSW_PERMANENT,
+};
+
+
 void __init udpv6_init(void)
 {
 	inet6_add_protocol(&udpv6_protocol);
+        inet6_register_protosw(&udpv6_protosw);
 }
diff -r -u linux-2.4.5-dist/net/netsyms.c linux/net/netsyms.c
--- linux-2.4.5-dist/net/netsyms.c	Fri Apr 27 16:15:01 2001
+++ linux/net/netsyms.c	Mon Jun 11 12:14:34 2001
@@ -234,6 +234,8 @@
 EXPORT_SYMBOL(inetdev_lock);
 EXPORT_SYMBOL(inet_add_protocol);
 EXPORT_SYMBOL(inet_del_protocol);
+EXPORT_SYMBOL(inet_register_protosw);
+EXPORT_SYMBOL(inet_unregister_protosw);
 EXPORT_SYMBOL(ip_route_output_key);
 EXPORT_SYMBOL(ip_route_input);
 EXPORT_SYMBOL(icmp_send);

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table
  2001-06-11 16:17               ` Alan Cox
@ 2001-06-11 18:31                 ` Jacob Luna Lundberg
  2001-06-11 18:48                   ` [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister Alan Cox
  2001-06-12  7:08                   ` [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregistertable Helge Hafting
  0 siblings, 2 replies; 51+ messages in thread
From: Jacob Luna Lundberg @ 2001-06-11 18:31 UTC (permalink / raw)
  To: Alan Cox; +Cc: hps, linux-kernel


On Mon, 11 Jun 2001, Alan Cox wrote:
> "The source code for a work means the preferred form of the work for
                                        ^^^^^^^^^
Preferred by whom?  The FSF?  Richard Stallman?  Hackers in general when
they take a vote?  Programmers in general?  What if the market is full of
VB programmers who prefer VB?  What if none of them know assembly?  They
might all vote that assembly isn't a preferred form.  If they aren't the
ones who count, then who does?  Maybe the authors count for more than
other people?  If so then it does seem they might like to write binaries
because they're crazy and they think it's fun or something.  I think that
the intention of the GPL is clear here but the language is not...

> making modifications to it.  For an executable work, complete source
> code means all the source code for all modules it contains, plus any
> associated interface definition files, plus the scripts used to
> control compilation and installation of the executable."

All of this chunk talks about what ``complete'' means not what ``source
code'' means.

-Jacob

--
This is the moment where the joystick snaps off in Comstock's hand.
Still, he can pound haplessly on the control panel.

 - Neal Stephenson, ``Cryptonomicon''


^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister
  2001-06-11 18:31                 ` Jacob Luna Lundberg
@ 2001-06-11 18:48                   ` Alan Cox
  2001-06-11 20:34                     ` Jacob Luna Lundberg
  2001-06-12  7:08                   ` [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregistertable Helge Hafting
  1 sibling, 1 reply; 51+ messages in thread
From: Alan Cox @ 2001-06-11 18:48 UTC (permalink / raw)
  To: jacob; +Cc: Alan Cox, hps, linux-kernel

> On Mon, 11 Jun 2001, Alan Cox wrote:
> > "The source code for a work means the preferred form of the work for
>                                         ^^^^^^^^^
> All of this chunk talks about what ``complete'' means not what ``source
> code'' means.

I disagree. But if you want an accurate assessment consult a lawyer.

Alan


^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister
  2001-06-11 18:48                   ` [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister Alan Cox
@ 2001-06-11 20:34                     ` Jacob Luna Lundberg
  0 siblings, 0 replies; 51+ messages in thread
From: Jacob Luna Lundberg @ 2001-06-11 20:34 UTC (permalink / raw)
  To: Alan Cox; +Cc: hps, linux-kernel


On Mon, 11 Jun 2001, Alan Cox wrote:
> > On Mon, 11 Jun 2001, Alan Cox wrote:
> > > "The source code for a work means the preferred form of the work for
> >                                         ^^^^^^^^^
> > All of this chunk talks about what ``complete'' means not what ``source
> > code'' means.
>
> I disagree. But if you want an accurate assessment consult a lawyer.

You misquote me.  I do agree that the first sentence is in reference to
source code.  :)  It's the rest that talks about complete source.  But I'm
not particularly interested in this.  What interests me is who defines
``preferred form''.  Some people argue that it is the author.  If so then
what are the safeguards to prevent the author from selecting binary as
their preferred source form for modifications?  It seems to me that the
FSF really meant some sort of community or industry preferred form.

-Jacob

-- 

We could view the formerly high infant mortality rates [of indigenous
populations] as a relatively inexpensive and egalitarian small-scale public
health program that offered the reasonable expectation of a healthy and
productive life for those surviving to age fifteen.

 - John H. Bodley, ``Victims of Progress'', 4th ed, pg 140


^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregistertable
  2001-06-11 18:31                 ` Jacob Luna Lundberg
  2001-06-11 18:48                   ` [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister Alan Cox
@ 2001-06-12  7:08                   ` Helge Hafting
  1 sibling, 0 replies; 51+ messages in thread
From: Helge Hafting @ 2001-06-12  7:08 UTC (permalink / raw)
  To: jacob, linux-kernel

Jacob Luna Lundberg wrote:
> 
> On Mon, 11 Jun 2001, Alan Cox wrote:
> > "The source code for a work means the preferred form of the work for
>                                         ^^^^^^^^^
> Preferred by whom?  The FSF?  Richard Stallman?  Hackers in general when
> they take a vote?  Programmers in general?  What if the market is full of
> VB programmers who prefer VB?  What if none of them know assembly?  They
> might all vote that assembly isn't a preferred form.  If they aren't the
> ones who count, then who does?  Maybe the authors count for more than
> other people?  If so then it does seem they might like to write binaries
> because they're crazy and they think it's fun or something.  I think that
> the intention of the GPL is clear here but the language is not...

The intention _is_ clear indeed.  That ought to be all we need really.
If it comes to the worst and somneone in court claims that binary
is their preferred form for _modification_ - have them demonstrate their
way of working to prove it can be done.  "Now write 'hello world'
in binary.  Wow, you managed that!  Now add a triple loop to it..."
This could be really interesting.

Somehow, I believe a driver written directly in binary (without even
assembly source) would be easy to reimplement from scratch in C.  
Because it'd be so small.

Helge Hafting

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH] sockreg2.4.5-06 inet[6]_create() register/unregister table
  2001-06-05 16:59 ` [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table La Monte H.P. Yarroll
  2001-06-06 22:07   ` La Monte H.P. Yarroll
  2001-06-11 18:26   ` [PATCH] sockreg2.4.5-06 " La Monte H.P. Yarroll
@ 2001-06-13 16:25   ` David S. Miller
  2 siblings, 0 replies; 51+ messages in thread
From: David S. Miller @ 2001-06-13 16:25 UTC (permalink / raw)
  To: La Monte H.P. Yarroll; +Cc: linux-kernel, sctp-developers-list


La Monte H.P. Yarroll writes:
 > Here is the register/unregister inet[6]_create() table patch revised
 > to disable deregistration and overriding of TCP and UDP.

I've applied your patches, thank you.

Please enable real tabs in your editor next time though :-)

Later,
David S. Miller
davem@redhat.com

^ permalink raw reply	[flat|nested] 51+ messages in thread

end of thread, other threads:[~2001-06-13 16:31 UTC | newest]

Thread overview: 51+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <3B1E5CC1.553B4EF1@alacritech.com>
2001-06-05 16:59 ` [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table La Monte H.P. Yarroll
2001-06-06 22:07   ` La Monte H.P. Yarroll
2001-06-07 19:11     ` Matthias Urlichs
2001-06-11 18:26   ` [PATCH] sockreg2.4.5-06 " La Monte H.P. Yarroll
2001-06-13 16:25   ` David S. Miller
2001-06-06 22:15 ` [PATCH] sockreg2.4.5-05 " David S. Miller
2001-06-06 22:36   ` Alexander Viro
2001-06-06 22:42   ` Richard Gooch
2001-06-06 22:52   ` David S. Miller
2001-06-06 23:21   ` Matt D. Robinson
2001-06-06 23:51     ` Richard Gooch
2001-06-07  0:51       ` David S. Miller
2001-06-07  5:37         ` George Bonser
2001-06-07  5:50         ` David S. Miller
2001-06-07  6:00           ` George Bonser
2001-06-07 15:18           ` watermodem
2001-06-07 15:51             ` Mike Galbraith
2001-06-09 22:09               ` [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregistertable watermodem
2001-06-09 23:15                 ` Alexander Viro
2001-06-10  2:59                 ` Horst von Brand
2001-06-10  4:38                 ` Mike Galbraith
2001-06-07  1:22       ` [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table Ben Greear
2001-06-07  5:16       ` Matt D. Robinson
2001-06-07 18:03         ` [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister Alan Cox
2001-06-07  5:46       ` [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table David S. Miller
2001-06-07  6:20       ` Richard Gooch
2001-06-07  6:47         ` Matt D. Robinson
2001-06-07 18:10     ` Alan Cox
2001-06-08  1:31     ` David S. Miller
2001-06-06 23:31   ` David S. Miller
2001-06-06 23:43   ` David S. Miller
2001-06-07 10:03     ` Henning P. Schmiedehausen
2001-06-07 10:50       ` Daniel Phillips
2001-06-07 17:52       ` Alan Cox
2001-06-08  8:29         ` Henning P. Schmiedehausen
2001-06-08 16:42           ` Alan Cox
2001-06-08 22:54           ` Albert D. Cahalan
2001-06-08 23:46             ` David Woodhouse
2001-06-11  8:45             ` Henning P. Schmiedehausen
2001-06-11  9:43               ` Helge Hafting
2001-06-11 16:17               ` Alan Cox
2001-06-11 18:31                 ` Jacob Luna Lundberg
2001-06-11 18:48                   ` [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister Alan Cox
2001-06-11 20:34                     ` Jacob Luna Lundberg
2001-06-12  7:08                   ` [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregistertable Helge Hafting
2001-06-07 10:05     ` [PATCH] sockreg2.4.5-05 inet[6]_create() register/unregister table Russell King
2001-06-07 15:27       ` Keith Owens
2001-06-07 17:01         ` David Woodhouse
2001-06-07 11:25     ` David S. Miller
2001-06-07 11:25     ` David S. Miller
2001-06-07  0:14   ` Ben Greear

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).