File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -337,10 +337,14 @@ mod getifaddrs_windows {
337337 }
338338 } ;
339339
340+ let index = match addr {
341+ IfAddr :: V4 ( _) => ifaddr. ipv4_index ( ) ,
342+ IfAddr :: V6 ( _) => ifaddr. ipv6_index ( ) ,
343+ } ;
340344 ret. push ( Interface {
341345 name : ifaddr. name ( ) ,
342346 addr,
343- index : ifaddr . index ( ) ,
347+ index,
344348 } ) ;
345349 }
346350 }
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ impl IpAdapterAddresses {
2828 . into_owned ( )
2929 }
3030
31- pub fn index ( & self ) -> Option < u32 > {
31+ pub fn ipv4_index ( & self ) -> Option < u32 > {
3232 let if_index = unsafe { ( * self . 0 ) . Anonymous1 . Anonymous . IfIndex } ;
3333 if if_index == 0 {
3434 None
@@ -37,6 +37,15 @@ impl IpAdapterAddresses {
3737 }
3838 }
3939
40+ pub fn ipv6_index ( & self ) -> Option < u32 > {
41+ let if_index = unsafe { ( * self . 0 ) . Ipv6IfIndex } ;
42+ if if_index == 0 {
43+ None
44+ } else {
45+ Some ( if_index)
46+ }
47+ }
48+
4049 pub fn prefixes ( & self ) -> PrefixesIterator {
4150 PrefixesIterator {
4251 _head : unsafe { & * self . 0 } ,
You can’t perform that action at this time.
0 commit comments