- Before doing ioctl(SIOCGIFNETMASK) put the proper IP address into the ifreq,

to obtain correct netmask in case of interface with multiple aliases.
- While here, remove a comment with a bad idea.

PR:		bin/42120
Submitted by:	Dmitry Frolov <frolov riss-telecom.ru>
This commit is contained in:
Gleb Smirnoff 2006-10-13 12:38:43 +00:00
parent ef5de9896f
commit 06274cee44

View File

@ -761,9 +761,9 @@ get_ether_addr(in_addr_t ipaddr, struct ether_addr *hwaddr)
for (ifr = ifc.ifc_req; ifr < ifend; ifr = NEXTIFR(ifr) ) {
if (ifr->ifr_addr.sa_family != AF_INET)
continue;
/* XXX can't we use *ifr instead of ifreq ? */
strncpy(ifreq.ifr_name, ifr->ifr_name,
sizeof(ifreq.ifr_name));
ifreq.ifr_addr = ifr->ifr_addr;
/*
* Check that the interface is up,
* and not point-to-point or loopback.