inetAddressUtil: save ifr_addr before query of IFFLAGS

Save before later calls clobber the buffer (was corrupting
sin_family).
This commit is contained in:
Michael Davidsaver
2018-07-02 11:11:12 -07:00
parent ccb1d1dbe3
commit 53a63f9a1f

View File

@@ -338,6 +338,9 @@ int discoverInterfaces(IfaceNodeVector &list, SOCKET socket, const osiSockAddr *
}
}
ifaceNode node;
node.ifaceAddr.sa = pIfreqList->ifr_addr;
status = socket_ioctl ( socket, SIOCGIFFLAGS, pIfreqList );
if ( status ) {
errlogPrintf ("discoverInterfaces(): net intf flags fetch for \"%s\" failed\n", pIfreqList->ifr_name);
@@ -362,9 +365,6 @@ int discoverInterfaces(IfaceNodeVector &list, SOCKET socket, const osiSockAddr *
}
}
ifaceNode node;
node.ifaceAddr.sa = pIfreqList->ifr_addr;
/*
* If this is an interface that supports
* broadcast fetch the broadcast address.