s4:lib/socket: use the same logic in iface_list_wildcard() as in smbd
authorStefan Metzmacher <metze@samba.org>
Thu, 27 Feb 2014 09:18:35 +0000 (10:18 +0100)
committerKarolin Seeger <kseeger@samba.org>
Tue, 1 Apr 2014 07:08:06 +0000 (09:08 +0200)
If we have ipv6 support we should listen on "::" too.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10464
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Change-Id: I8ce185d5070280149bee9fd33010443be9031089
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit a571fe520d09a00273a58b1fb0fa9aab8e0aefce)

source4/lib/socket/interface.c

index 7a4733f466665298c3c579a63f0ecd954c76964a..cdfadc9953c7ea4ca272456931f25ee7f0e2c285 100644 (file)
@@ -505,27 +505,11 @@ bool iface_list_same_net(const char *ip1, const char *ip2, const char *netmask)
 */
 const char **iface_list_wildcard(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx)
 {
-       const char **ret;
-       ret = (const char **)str_list_make(mem_ctx, "0.0.0.0", NULL);
-       if (ret == NULL) return NULL;
-
+       char **ret;
 #ifdef HAVE_IPV6
-       if (lpcfg_parm_bool(lp_ctx, NULL, "ipv6", "enable", true)) {
-               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);
-       }
+       ret = str_list_make(mem_ctx, "::,0.0.0.0", NULL);
+#else
+       ret = str_list_make(mem_ctx, "0.0.0.0", NULL);
 #endif
-
-       return ret;
+       return discard_const_p(const char *, ret);
 }