summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-10-02 20:39:41 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:31:07 -0500
commit989120d53e69adfc3fb86775a683147cb62d8d04 (patch)
treefc074fe745d2c8aa99c3e61f2fc46add229087aa
parentc7da0dced68ec12a689effcc9c7351b46a815831 (diff)
downloadsamba-989120d53e69adfc3fb86775a683147cb62d8d04.tar.gz
samba-989120d53e69adfc3fb86775a683147cb62d8d04.tar.bz2
samba-989120d53e69adfc3fb86775a683147cb62d8d04.zip
r25475: Fix braindead mistakes I made pointed out by Simo and
James (how did this compile ? :-). Jeremy. (This used to be commit ae8efc60aa1ddff795d16b1fb1bfe8cc392f49b3)
-rw-r--r--source3/lib/interfaces.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/source3/lib/interfaces.c b/source3/lib/interfaces.c
index 07abf4b1c6..e5b9d87488 100644
--- a/source3/lib/interfaces.c
+++ b/source3/lib/interfaces.c
@@ -102,7 +102,7 @@ static int _get_interfaces(struct iface_struct *ifaces, int max_interfaces)
struct ifaddrs *ifptr = NULL;
int total = 0;
- if (getifaddrs(&ifp) < 0) {
+ if (getifaddrs(&iflist) < 0) {
return -1;
}
@@ -111,6 +111,10 @@ static int _get_interfaces(struct iface_struct *ifaces, int max_interfaces)
ifptr != NULL && total < max_interfaces;
ifptr = ifptr->ifa_next) {
+ if (!ifptr->ifa_addr || !ifptr->ifa_netmask) {
+ continue;
+ }
+
/* Skip ipv6 for now. */
if (ifptr->ifa_addr->sa_family != AF_INET) {
continue;
@@ -125,7 +129,7 @@ static int _get_interfaces(struct iface_struct *ifaces, int max_interfaces)
((struct sockaddr_in *)ifptr->ifa_addr).sin_addr;
ifaces[total].iface_netmask.netmask =
- ((struct sockaddr_in *)ifptr->ifa_addr)->sin_addr;
+ ((struct sockaddr_in *)ifptr->ifa_netmask)->sin_addr;
strncpy(ifaces[total].name, ifptr->ifa_name,
sizeof(ifaces[total].name)-1);