/****************************************************************************
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;
return;
}
+ if (!enable_ipv6 && ifs->ip.ss_family != AF_INET) {
+ return;
+ }
+
iface = talloc(*interfaces == NULL ? mem_ctx : *interfaces, struct interface);
if (iface == NULL)
return;
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;
for (i=0;i<total_probed;i++) {
if (gen_fnmatch(token, probed_ifaces[i].name) == 0) {
add_interface(mem_ctx, &probed_ifaces[i],
- local_interfaces);
+ local_interfaces, enable_ipv6);
added = true;
}
}
for (i=0;i<total_probed;i++) {
if (sockaddr_equal((struct sockaddr *)&ss, (struct sockaddr *)&probed_ifaces[i].ip)) {
add_interface(mem_ctx, &probed_ifaces[i],
- local_interfaces);
+ local_interfaces, enable_ipv6);
return;
}
}
p,
probed_ifaces[i].name));
add_interface(mem_ctx, &probed_ifaces[i],
- local_interfaces);
+ local_interfaces, enable_ipv6);
probed_ifaces[i].netmask = saved_mask;
return;
}
ifs.netmask = ss_mask;
ifs.bcast = ss_bcast;
add_interface(mem_ctx, &ifs,
- local_interfaces);
+ local_interfaces, enable_ipv6);
}
/**
load the list of network interfaces
**/
-void load_interface_list(TALLOC_CTX *mem_ctx, const char **interfaces, struct interface **local_interfaces)
+void load_interface_list(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, struct interface **local_interfaces)
{
- const char **ptr = interfaces;
+ const char **ptr = lpcfg_interfaces(lp_ctx);
int i;
struct iface_struct *ifaces;
int total_probed;
+ bool enable_ipv6 = lpcfg_parm_bool(lp_ctx, NULL, "ipv6", "enable", false);
*local_interfaces = NULL;
}
for (i=0;i<total_probed;i++) {
if (!is_loopback_addr((struct sockaddr *)&ifaces[i].ip)) {
- add_interface(mem_ctx, &ifaces[i], local_interfaces);
+ add_interface(mem_ctx, &ifaces[i], local_interfaces, enable_ipv6);
}
}
}
while (ptr && *ptr) {
- interpret_interface(mem_ctx, *ptr, ifaces, total_probed, local_interfaces);
+ interpret_interface(mem_ctx, *ptr, ifaces, total_probed, local_interfaces, enable_ipv6);
ptr++;
}
if (ret == NULL) return NULL;
#ifdef HAVE_IPV6
- return str_list_add(ret, "::");
+ if (lpcfg_parm_bool(lp_ctx, NULL, "ipv6", "enable", false)) {
+ return str_list_add(ret, "::");
+ }
#endif
return ret;