1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-09 22:21:29 +00:00

Add the intf_entry.intf_index member.

This is the operating system's interface index, as used by
if_indextoname and sockaddr_sin6.sin6_scope_id.
This commit is contained in:
david
2011-08-30 23:55:07 +00:00
parent 9932429abd
commit 4f454a29d2
2 changed files with 6 additions and 0 deletions

View File

@@ -19,6 +19,7 @@
struct intf_entry {
u_int intf_len; /* length of entry */
char intf_name[INTF_NAME_LEN]; /* interface name */
u_int intf_index; /* interface index (r/o) */
u_short intf_type; /* interface type (r/o) */
u_short intf_flags; /* interface flags */
u_int intf_mtu; /* interface MTU */

View File

@@ -391,6 +391,11 @@ _intf_get_noalias(intf_t *intf, struct intf_entry *entry)
strlcpy(ifr.ifr_name, entry->intf_name, sizeof(ifr.ifr_name));
/* Get interface index. */
if (ioctl(intf->fd, SIOCGIFINDEX, &ifr) < 0)
return (-1);
entry->intf_index = ifr.ifr_ifindex;
/* Get interface flags. */
if (ioctl(intf->fd, SIOCGIFFLAGS, &ifr) < 0)
return (-1);