summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1999-07-14 06:53:28 +0000
committerAndrew Tridgell <tridge@samba.org>1999-07-14 06:53:28 +0000
commit634373870626dd36648ec9e2dc650730cf4d28ce (patch)
treeccd93ab5f0a9d8332a70b7b034f247f7ec7c0d17
parent4ffb5e498ac94d356c33367a8c3852b39d3d7ef9 (diff)
downloadsamba-634373870626dd36648ec9e2dc650730cf4d28ce.tar.gz
transfer the SIGIOCONF fix from the 2.0 branch
-rw-r--r--source/lib/netmask.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/source/lib/netmask.c b/source/lib/netmask.c
index b7958d86a13..f1cf4b5192b 100644
--- a/source/lib/netmask.c
+++ b/source/lib/netmask.c
@@ -286,6 +286,8 @@ this one is for AIX
/* Loop through interfaces, looking for given IP address */
i = ifc.ifc_len;
while (i > 0) {
+ int inc;
+
#ifdef DEBUG
fprintf(stderr,"interface %s\n",
inet_ntoa((*(struct sockaddr_in *)&ifr->ifr_addr).sin_addr));
@@ -294,9 +296,21 @@ this one is for AIX
(*(struct sockaddr_in *) &ifr->ifr_addr).sin_addr.s_addr) {
break;
}
- i -= ifr->ifr_addr.sa_len + IFNAMSIZ;
- ifr = (struct ifreq*) ((char*) ifr + ifr->ifr_addr.sa_len +
- IFNAMSIZ);
+
+ /*
+ * Patch from Archie Cobbs (archie@whistle.com).
+ * The addresses in the SIOCGIFCONF interface list have a
+ * minimum size. Usually this doesn't matter, but if your machine has
+ * tunnel interfaces, etc. that have a zero length "link address",
+ * this does matter.
+ */
+
+ inc = ifr->ifr_addr.sa_len;
+ if (inc < sizeof(ifr->ifr_addr))
+ inc = sizeof(ifr->ifr_addr);
+ inc += IFNAMSIZ;
+ ifr = (struct ifreq*) (((char*) ifr) + inc);
+ i -= inc;
}