[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

(usagi-users 01026) Re: Multicast bind problem...



In article <200111150156.JAA15915@xxxxxxxxxxxxxxxxxxxxxxx> (at Thu, 15 Nov 2001 10:02:48 -0500), Parijat Mishra <parijat@xxxxxxxxxxxxxx> says:

> am facing is that the second and subsequent processes' bind() fails with 
> "address already in use" error.  Each process sets the SO_REUSEADDR option 
> before bind().  BTW, is SO_REUSEPORT available on Linux?

We've tried having SO_REUSEPORT compatible code for multicasts.
But it seems that we have a bug in that code.


> SO is there something wrong with bind() on USAGI? Any hints?

Could you try this patch, please?
(endian issue; sigh....)


Index: kernel/linux24/net/ipv4/udp.c
===================================================================
RCS file: /cvsroot/usagi/usagi/kernel/linux24/net/ipv4/udp.c,v
retrieving revision 1.43
diff -u -r1.43 udp.c
--- kernel/linux24/net/ipv4/udp.c	2001/10/24 06:35:40	1.43
+++ kernel/linux24/net/ipv4/udp.c	2001/11/15 02:27:04
@@ -179,7 +179,7 @@
 			sk_reuse |= 2;
 #endif
 		if (sk->reuse)
-			sk_reuse |= IN_MULTICAST(sk->rcv_saddr) ? 3 : 1;
+			sk_reuse |= MULTICAST(sk->rcv_saddr) ? 3 : 1;
 
 		for (sk2 = udp_hash[snum & (UDP_HTABLE_SIZE - 1)];
 		     sk2 != NULL;
@@ -246,7 +246,7 @@
 			if (sk2->reuse)
 				sk2_reuse |= addr_type2 != IPV6_ADDR_MAPPED ?
 						((addr_type2 & IPV6_ADDR_MULTICAST) ? 3 : 1) :
-						(IN_MULTICAST(sk2->rcv_saddr) ? 3 : 1);
+						(MULTICAST(sk2->rcv_saddr) ? 3 : 1);
 
 			if (sk2_reuse & sk_reuse) {	/* NOT && */
 #ifdef CONFIG_NET_MODERATE_REUSE
Index: kernel/linux24/net/ipv4/tcp_ipv4.c
===================================================================
RCS file: /cvsroot/usagi/usagi/kernel/linux24/net/ipv4/tcp_ipv4.c,v
retrieving revision 1.53
diff -u -r1.53 tcp_ipv4.c
--- kernel/linux24/net/ipv4/tcp_ipv4.c	2001/11/06 14:46:56	1.53
+++ kernel/linux24/net/ipv4/tcp_ipv4.c	2001/11/15 02:27:05
@@ -201,7 +201,7 @@
 		sk_reuse |= 2;
 #endif
 	if (sk->reuse)
-		sk_reuse |= IN_MULTICAST(sk->rcv_saddr) ? 3 : 1;
+		sk_reuse |= MULTICAST(sk->rcv_saddr) ? 3 : 1;
 
 	for( ; sk2 != NULL; sk2 = sk2->bind_next) {
 #if defined(CONFIG_NET_MODERATE_REUSE) || defined(CONFIG_IPV6_MODERATE_DOUBLE_BIND)
@@ -267,7 +267,7 @@
 		if (sk2->reuse)
 			sk2_reuse |= addr_type2 != IPV6_ADDR_MAPPED ?
 					((addr_type2 & IPV6_ADDR_MULTICAST) ? 3 : 1) :
-					(IN_MULTICAST(sk2->rcv_saddr) ? 3 : 1);
+					(MULTICAST(sk2->rcv_saddr) ? 3 : 1);
 
 		if (sk2_reuse & sk_reuse) {	/* NOT && */
 			ret = 1;
Index: kernel/linux24/net/ipv6/udp.c
===================================================================
RCS file: /cvsroot/usagi/usagi/kernel/linux24/net/ipv6/udp.c,v
retrieving revision 1.43
diff -u -r1.43 udp.c
--- kernel/linux24/net/ipv6/udp.c	2001/09/24 07:38:47	1.43
+++ kernel/linux24/net/ipv6/udp.c	2001/11/15 02:27:05
@@ -129,7 +129,7 @@
 		if (sk->reuse)
 			sk_reuse |= addr_type != IPV6_ADDR_MAPPED ?
 					((addr_type & IPV6_ADDR_MULTICAST) ? 3 : 1) :
-					(IN_MULTICAST(sk->rcv_saddr) ? 3 : 1);
+					(MULTICAST(sk->rcv_saddr) ? 3 : 1);
 
 		for (sk2 = udp_hash[snum & (UDP_HTABLE_SIZE - 1)];
 		     sk2 != NULL;
@@ -192,7 +192,7 @@
 			if (sk2->reuse)
 				sk2_reuse |= addr_type2 != IPV6_ADDR_MAPPED ?
 						((addr_type2 & IPV6_ADDR_MULTICAST) ? 3 : 1) :
-						(IN_MULTICAST(sk2->rcv_saddr) ? 3 : 1);
+						(MULTICAST(sk2->rcv_saddr) ? 3 : 1);
 
 			if (sk2_reuse & sk_reuse) {	/* NOT && */
 #ifdef CONFIG_NET_MODERATE_REUSE
Index: kernel/linux24/net/ipv6/tcp_ipv6.c
===================================================================
RCS file: /cvsroot/usagi/usagi/kernel/linux24/net/ipv6/tcp_ipv6.c,v
retrieving revision 1.50
diff -u -r1.50 tcp_ipv6.c
--- kernel/linux24/net/ipv6/tcp_ipv6.c	2001/10/24 06:35:41	1.50
+++ kernel/linux24/net/ipv6/tcp_ipv6.c	2001/11/15 02:27:05
@@ -176,7 +176,7 @@
 			if (sk->reuse)
 				sk_reuse |= addr_type != IPV6_ADDR_MAPPED ?
 						((addr_type & IPV6_ADDR_MULTICAST) ? 3 : 1) :
-						(IN_MULTICAST(sk->rcv_saddr) ? 3 : 1);
+						(MULTICAST(sk->rcv_saddr) ? 3 : 1);
 
 			/* We must walk the whole port owner list in this case. -DaveM */
 			for( ; sk2 != NULL; sk2 = sk2->bind_next) {
@@ -238,7 +238,7 @@
 				if (sk2->reuse)
 					sk2_reuse |= addr_type2 != IPV6_ADDR_MAPPED ?
 							((addr_type2 & IPV6_ADDR_MULTICAST) ? 3 : 1) :
-							(IN_MULTICAST(sk2->rcv_saddr) ? 3 : 1);
+							(MULTICAST(sk2->rcv_saddr) ? 3 : 1);
 
 				if (sk2_reuse & sk_reuse) {	/* NOT && */
 					ret = 1;

--
yoshfuji