[radvd-devel-l] [PATCH] Ignore EADDRINUSE when rejoining all-routers multicast address

YOSHIFUJI Hideaki / 吉藤英明 yoshfuji at linux-ipv6.org
Tue Jul 5 01:25:31 EDT 2005


Hello.

linux-2.6.12-bk4 or later return error w/ errno == EADDRINUSE.
Let's ignore it, or radvd dies when received HUP signal.

Thanks.

Index: device-linux.c
===================================================================
RCS file: /work/cvsroot/radvd/device-linux.c,v
retrieving revision 1.12
diff -u -r1.12 device-linux.c
--- device-linux.c	7 Jan 2005 19:16:52 -0000	1.12
+++ device-linux.c	5 Jul 2005 05:19:43 -0000
@@ -167,8 +167,15 @@
 
 	if (setsockopt(sock, SOL_IPV6, IPV6_ADD_MEMBERSHIP, &mreq, sizeof(mreq)) < 0)
 	{
-		flog(LOG_ERR, "can't join ipv6-allrouters on %s", iface->Name);
-		return (-1);
+		if (errno != EADDRINUSE)
+		{
+			flog(LOG_ERR, "can't join ipv6-allrouters on %s", iface->Name);
+			return (-1);
+		}
+		else {
+			flog(LOG_WARNING, "can't join ipv6-allrouters on %s (ignored)", iface->Name);
+			return (0);
+		}
 	}
 
 	return (0);

-- 
YOSHIFUJI Hideaki @ USAGI Project  <yoshfuji at linux-ipv6.org>
GPG-FP  : 9022 65EB 1ECF 3AD1 0BDF  80D8 4807 F894 E062 0EEA



More information about the radvd-devel-l mailing list