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:
@@ -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 */
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user