diff options
Diffstat (limited to 'source/lib/interface.c')
-rw-r--r-- | source/lib/interface.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/source/lib/interface.c b/source/lib/interface.c index 70ffcb0e1d5..3e45d627d37 100644 --- a/source/lib/interface.c +++ b/source/lib/interface.c @@ -26,6 +26,8 @@ static struct iface_struct *probed_ifaces; static int total_probed; +extern int DEBUGLEVEL; + struct in_addr ipzero; struct in_addr allones_ip; struct in_addr loopback_ip; @@ -109,7 +111,7 @@ static void interpret_interface(char *token) /* first check if it is an interface name */ for (i=0;i<total_probed;i++) { - if (gen_fnmatch(token, probed_ifaces[i].name) == 0) { + if (ms_fnmatch(token, probed_ifaces[i].name) == 0) { add_interface(probed_ifaces[i].ip, probed_ifaces[i].netmask); added = 1; @@ -118,7 +120,7 @@ static void interpret_interface(char *token) if (added) return; /* maybe it is a DNS name */ - p = strchr_m(token,'/'); + p = strchr(token,'/'); if (!p) { ip = *interpret_addr2(token); for (i=0;i<total_probed;i++) { @@ -166,7 +168,8 @@ load the list of network interfaces ****************************************************************************/ void load_interfaces(void) { - char **ptr; + char *ptr; + fstring token; int i; struct iface_struct ifaces[MAX_INTERFACES]; @@ -176,14 +179,17 @@ void load_interfaces(void) allones_ip = *interpret_addr2("255.255.255.255"); loopback_ip = *interpret_addr2("127.0.0.1"); - SAFE_FREE(probed_ifaces); + if (probed_ifaces) { + free(probed_ifaces); + probed_ifaces = NULL; + } /* dump the current interfaces if any */ while (local_interfaces) { struct interface *iface = local_interfaces; DLIST_REMOVE(local_interfaces, local_interfaces); ZERO_STRUCTPN(iface); - SAFE_FREE(iface); + free(iface); } /* probe the kernel for interfaces */ @@ -195,7 +201,7 @@ void load_interfaces(void) /* if we don't have a interfaces line then use all broadcast capable interfaces except loopback */ - if (!ptr || !*ptr || !**ptr) { + if (!ptr || !*ptr) { if (total_probed <= 0) { DEBUG(0,("ERROR: Could not determine network interfaces, you must use a interfaces config line\n")); exit(1); @@ -210,11 +216,8 @@ void load_interfaces(void) return; } - if (ptr) { - while (*ptr) { - interpret_interface(*ptr); - ptr++; - } + while (next_token(&ptr,token,NULL,sizeof(token))) { + interpret_interface(token); } if (!local_interfaces) { |