diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/if.c | 4 | ||||
-rw-r--r-- | sys/net/if.h | 2 | ||||
-rw-r--r-- | sys/sys/sockio.h | 1 |
3 files changed, 7 insertions, 0 deletions
diff --git a/sys/net/if.c b/sys/net/if.c index 2728141..7ffb296 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1145,6 +1145,10 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, struct thread *td) ifr = (struct ifreq *)data; switch (cmd) { + case SIOCGIFINDEX: + ifr->ifr_index = ifp->if_index; + break; + case SIOCGIFFLAGS: ifr->ifr_flags = ifp->if_flags; break; diff --git a/sys/net/if.h b/sys/net/if.h index eb4d199..83116b9 100644 --- a/sys/net/if.h +++ b/sys/net/if.h @@ -200,6 +200,7 @@ struct ifreq { struct sockaddr ifru_dstaddr; struct sockaddr ifru_broadaddr; short ifru_flags[2]; + short ifru_index; int ifru_metric; int ifru_mtu; int ifru_phys; @@ -219,6 +220,7 @@ struct ifreq { #define ifr_data ifr_ifru.ifru_data /* for use by interface */ #define ifr_reqcap ifr_ifru.ifru_cap[0] /* requested capabilities */ #define ifr_curcap ifr_ifru.ifru_cap[1] /* current capabilities */ +#define ifr_index ifr_ifru.ifru_index /* interface index */ }; #define _SIZEOF_ADDR_IFREQ(ifr) \ diff --git a/sys/sys/sockio.h b/sys/sys/sockio.h index c681f8e..03ea70c 100644 --- a/sys/sys/sockio.h +++ b/sys/sys/sockio.h @@ -79,6 +79,7 @@ #define SIOCDLIFADDR _IOW('i', 29, struct if_laddrreq) /* delete IF addr */ #define SIOCSIFCAP _IOW('i', 30, struct ifreq) /* set IF features */ #define SIOCGIFCAP _IOWR('i', 31, struct ifreq) /* get IF features */ +#define SIOCGIFINDEX _IOWR('i', 32, struct ifreq) /* get IF index */ #define SIOCADDMULTI _IOW('i', 49, struct ifreq) /* add m'cast addr */ #define SIOCDELMULTI _IOW('i', 50, struct ifreq) /* del m'cast addr */ |