From 44d47e85157209f5aec1a6e0cd507c1084716816 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 2 Jun 2011 15:39:54 +1000 Subject: s4-ipv6: allow ipv6 to be enabled/disabled in smb.conf this adds the parametric option ipv6:enable=true/false It defaults to false for now, until the remaining issues with testing of ipv6 are resolved --- source4/lib/socket/interface.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) (limited to 'source4') diff --git a/source4/lib/socket/interface.c b/source4/lib/socket/interface.c index 3737f57f9b..00550a9ed4 100644 --- a/source4/lib/socket/interface.c +++ b/source4/lib/socket/interface.c @@ -75,7 +75,8 @@ static struct interface *iface_list_find(struct interface *interfaces, /**************************************************************************** add an interface to the linked list of interfaces ****************************************************************************/ -static void add_interface(TALLOC_CTX *mem_ctx, const struct iface_struct *ifs, struct interface **interfaces) +static void add_interface(TALLOC_CTX *mem_ctx, const struct iface_struct *ifs, struct interface **interfaces, + bool enable_ipv6) { char addr[INET6_ADDRSTRLEN]; struct interface *iface; @@ -92,6 +93,10 @@ static void add_interface(TALLOC_CTX *mem_ctx, const struct iface_struct *ifs, s return; } + if (!enable_ipv6 && ifs->ip.ss_family != AF_INET) { + return; + } + iface = talloc(*interfaces == NULL ? mem_ctx : *interfaces, struct interface); if (iface == NULL) return; @@ -147,7 +152,8 @@ static void interpret_interface(TALLOC_CTX *mem_ctx, const char *token, struct iface_struct *probed_ifaces, int total_probed, - struct interface **local_interfaces) + struct interface **local_interfaces, + bool enable_ipv6) { struct sockaddr_storage ss; struct sockaddr_storage ss_mask; @@ -163,7 +169,7 @@ static void interpret_interface(TALLOC_CTX *mem_ctx, for (i=0;i