File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -45,12 +45,18 @@ impl InterfaceAddress {
45
45
destination : None ,
46
46
} ;
47
47
48
- let ifo = unsafe { SockAddr :: from_libc_sockaddr ( info. ifa_ifu ) } ;
48
+ let ifu : * mut libc:: sockaddr ;
49
+
50
+ #[ cfg( any( target_os = "linux" , target_os = "emscripten" , target_os = "fuchsia" ) ) ]
51
+ { ifu = info. ifa_ifu ; }
52
+
53
+ #[ cfg( not( any( target_os = "linux" , target_os = "emscripten" , target_os = "fuchsia" ) ) ) ]
54
+ { ifu = info. ifa_dstaddr ; }
55
+
49
56
if addr. flags . contains ( IFF_POINTOPOINT ) {
50
- addr. destination = ifo;
51
- }
52
- if addr. flags . contains ( IFF_BROADCAST ) {
53
- addr. broadcast = ifo;
57
+ addr. destination = unsafe { SockAddr :: from_libc_sockaddr ( ifu) } ;
58
+ } else if addr. flags . contains ( IFF_BROADCAST ) {
59
+ addr. broadcast = unsafe { SockAddr :: from_libc_sockaddr ( ifu) } ;
54
60
}
55
61
56
62
addr
You can’t perform that action at this time.
0 commit comments