diff options
author | Jeremy Allison <jra@samba.org> | 2007-10-24 12:44:38 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2007-10-24 12:44:38 -0700 |
commit | e01cbcb28e63abb0f681a5a168fc2445744eec93 (patch) | |
tree | 74223ba206b6680d4a08530cb190321c870e9b2a /source3 | |
parent | 6a6c549cdc24ae49aced26020cc7b08da921e537 (diff) | |
download | samba-e01cbcb28e63abb0f681a5a168fc2445744eec93.tar.gz samba-e01cbcb28e63abb0f681a5a168fc2445744eec93.tar.bz2 samba-e01cbcb28e63abb0f681a5a168fc2445744eec93.zip |
Fix for AIX interface code from Kyle Stemen <kstemen@centeris.com>
Jeremy.
(This used to be commit 4d4ab9aeb9d85b4c98cbf8a8363a9cefecd4b365)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/lib/interfaces.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/source3/lib/interfaces.c b/source3/lib/interfaces.c index ae6c972d24..ee5d9dfb54 100644 --- a/source3/lib/interfaces.c +++ b/source3/lib/interfaces.c @@ -330,7 +330,9 @@ static int _get_interfaces(struct iface_struct *ifaces, int max_interfaces) continue; } - strlcpy(ifaces[total].name, iname, sizeof(ifaces[total].name)); + strlcpy(ifaces[total].name, + ifreq.ifr_name, + sizeof(ifaces[total].name)); memcpy(&ifaces[total].ip, &ifreq.ifr_addr, sizeof(struct sockaddr_in)); @@ -444,19 +446,19 @@ static int _get_interfaces(struct iface_struct *ifaces, int max_interfaces) sizeof(struct sockaddr_in)); if (ifaces[total].flags & IFF_BROADCAST) { - if (ioctl(fd, SIOCGIFBRDADDR, &ifr[i]) != 0) { - continue; + if (ioctl(fd, SIOCGIFBRDADDR, ifr) != 0) { + goto next; } - memcpy(&ifaces[total].bcast, &ifr[i].ifr_broadaddr, + memcpy(&ifaces[total].bcast, &ifr->ifr_broadaddr, sizeof(struct sockaddr_in)); } else if (ifaces[total].flags & IFF_POINTOPOINT) { - if (ioctl(fd, SIOCGIFDSTADDR, &ifr[i]) != 0) { - continue; + if (ioctl(fd, SIOCGIFDSTADDR, ifr) != 0) { + goto next; } - memcpy(&ifaces[total].bcast, &ifr[i].ifr_dstaddr, + memcpy(&ifaces[total].bcast, &ifr->ifr_dstaddr, sizeof(struct sockaddr_in)); } else { - continue; + goto next; } @@ -532,7 +534,12 @@ static int iface_comp(struct iface_struct *i1, struct iface_struct *i2) } #endif - if (i1->ip.ss_family == AF_INET) { + /* AIX uses __ss_family instead of ss_family inside of + sockaddr_storage. Instead of trying to figure out which field to + use, we can just cast it to a sockaddr. + */ + + if (((struct sockaddr *)&i1->ip)->sa_family == AF_INET) { struct sockaddr_in *s1 = (struct sockaddr_in *)&i1->ip; struct sockaddr_in *s2 = (struct sockaddr_in *)&i2->ip; |