mirror of
https://github.com/nmap/nmap.git
synced 2026-06-26 03:03:55 +00:00
Use if_nametoindex instead of SIOCGIFINDEX.
The latter isn't available on OS X.
This commit is contained in:
parent
2511cd1d2a
commit
70d2105b9f
1 changed files with 4 additions and 4 deletions
|
|
@ -389,12 +389,12 @@ _intf_get_noalias(intf_t *intf, struct intf_entry *entry)
|
|||
{
|
||||
struct ifreq ifr;
|
||||
|
||||
strlcpy(ifr.ifr_name, entry->intf_name, sizeof(ifr.ifr_name));
|
||||
|
||||
/* Get interface index. */
|
||||
if (ioctl(intf->fd, SIOCGIFINDEX, &ifr) < 0)
|
||||
entry->intf_index = if_nametoindex(entry->intf_name);
|
||||
if (entry->intf_index == 0)
|
||||
return (-1);
|
||||
entry->intf_index = ifr.ifr_ifindex;
|
||||
|
||||
strlcpy(ifr.ifr_name, entry->intf_name, sizeof(ifr.ifr_name));
|
||||
|
||||
/* Get interface flags. */
|
||||
if (ioctl(intf->fd, SIOCGIFFLAGS, &ifr) < 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue