diff options
author | Andrew Tridgell <tridge@samba.org> | 2011-05-12 12:23:35 +0200 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2011-06-06 12:26:09 +1000 |
commit | 2fc11518b7573bce3cdf2f2acf7dec024f22e9c6 (patch) | |
tree | a0e88502838d63b17838c29d5db1a4e152cdd4b0 /source4 | |
parent | 13ac91d9a1e695aa5b4147bc13c728eb1cb562e8 (diff) | |
download | samba-2fc11518b7573bce3cdf2f2acf7dec024f22e9c6.tar.gz samba-2fc11518b7573bce3cdf2f2acf7dec024f22e9c6.tar.bz2 samba-2fc11518b7573bce3cdf2f2acf7dec024f22e9c6.zip |
s4-ipv6: added iface_list_wildcard()
this returns a list of wildcard address to listen on, when we don't
have 'bind interfaces only' set. It is a list, not a single address,
we need to listen separately for the IPv6 "::" address from the IPv4
0.0.0.0 address.
This also takes account of the loadparm "socket address" option
Diffstat (limited to 'source4')
-rw-r--r-- | source4/lib/socket/interface.c | 28 | ||||
-rw-r--r-- | source4/lib/socket/wscript_build | 2 |
2 files changed, 29 insertions, 1 deletions
diff --git a/source4/lib/socket/interface.c b/source4/lib/socket/interface.c index b762f5573a..83d8e4c129 100644 --- a/source4/lib/socket/interface.c +++ b/source4/lib/socket/interface.c @@ -21,6 +21,7 @@ #include "includes.h" #include "system/network.h" +#include "param/param.h" #include "lib/socket/netif.h" #include "../lib/util/util_net.h" #include "../lib/util/dlinklist.h" @@ -428,3 +429,30 @@ bool iface_list_same_net(const char *ip1, const char *ip2, const char *netmask) interpret_addr2(ip2), interpret_addr2(netmask)); } + +/** + return the list of wildcard interfaces + this will include the IPv4 0.0.0.0, and may include IPv6 :: + it is overridden by the 'socket address' option in smb.conf +*/ +const char **iface_list_wildcard(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx) +{ + const char **ret; + const char *socket_address; + + /* the user may have configured a specific address */ + socket_address = lpcfg_socket_address(lp_ctx); + if (strcmp(socket_address, "") != 0) { + ret = (const char **)str_list_make(mem_ctx, socket_address, NULL); + return ret; + } + + ret = (const char **)str_list_make(mem_ctx, "0.0.0.0", NULL); + if (ret == NULL) return NULL; + +#ifdef HAVE_IPV6 + return str_list_add(ret, "::"); +#endif + + return ret; +} diff --git a/source4/lib/socket/wscript_build b/source4/lib/socket/wscript_build index fa497335fb..c10970d17a 100644 --- a/source4/lib/socket/wscript_build +++ b/source4/lib/socket/wscript_build @@ -2,7 +2,7 @@ bld.SAMBA_LIBRARY('netif', source='interface.c', - deps='samba-util interfaces', + deps='samba-util interfaces samba-hostconfig', private_library=True, autoproto='netif_proto.h' ) |