From 1be5a9b1fdbf891749615e87391cdd2a9c4d7113 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sun, 10 Jul 2011 15:13:45 +0200 Subject: s4:lib/socket: iface_list_wildcard() should only return "::" if we have ipv6 interfaces If glibc has IPv6 support, but it's not enabled in the running kernel we should not try to listen on "::". metze --- source4/lib/socket/interface.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/source4/lib/socket/interface.c b/source4/lib/socket/interface.c index d5b610fea7..42e1946768 100644 --- a/source4/lib/socket/interface.c +++ b/source4/lib/socket/interface.c @@ -520,7 +520,19 @@ const char **iface_list_wildcard(TALLOC_CTX *mem_ctx, struct loadparm_context *l #ifdef HAVE_IPV6 if (lpcfg_parm_bool(lp_ctx, NULL, "ipv6", "enable", true)) { - return str_list_add(ret, "::"); + struct interface *local_interfaces = NULL; + + load_interface_list(ret, lp_ctx, &local_interfaces); + + if (iface_list_first_v6(local_interfaces)) { + TALLOC_FREE(local_interfaces); + /* + * only add "::" if we have at least + * one ipv6 interface + */ + return str_list_add(ret, "::"); + } + TALLOC_FREE(local_interfaces); } #endif -- cgit