[Olsr-dev] [PATCH 2/2] fix txtinfo too listen on ipv6 port only

Patrick Grimm (spam-protected)
Thu Jul 10 18:41:28 CEST 2014


If not IPV6_V6ONLY flag ist set then olsrd with ipversion=6
is listen on IPv6 and IPv4 tcp port. A second process with
ipversion=4 can’t listen on IPv4 tcp Port.

Signed-off-by: Patrick Grimm <(spam-protected)>
---
 lib/txtinfo/src/olsrd_txtinfo.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lib/txtinfo/src/olsrd_txtinfo.c b/lib/txtinfo/src/olsrd_txtinfo.c
index 66937fa..0ca6b11 100644
--- a/lib/txtinfo/src/olsrd_txtinfo.c
+++ b/lib/txtinfo/src/olsrd_txtinfo.c
@@ -198,6 +198,14 @@ plugin_ipc_init(void)
       return 0;
     }
 #endif /* (defined __FreeBSD__ || defined __FreeBSD_kernel__) && defined SO_NOSIGPIPE */
+#if defined linux
+    if (olsr_cnf->ip_version == AF_INET6) {
+      if (setsockopt(ipc_socket, IPPROTO_IPV6, IPV6_V6ONLY, (char *)&yes, sizeof(yes)) < 0) {
+        perror("IPV6_V6ONLY failed");
+        return 0;
+      }
+    }
+#endif /* defined linux */
     /* Bind the socket */
 
     /* complete the socket structure */
-- 
2.0.1





More information about the Olsr-dev mailing list