@@ -7,6 +7,13 @@ use std::fmt;
7
7
use crate :: { Error , NixPath , Result } ;
8
8
use libc:: c_uint;
9
9
10
+ #[ cfg( not( solarish) ) ]
11
+ /// type alias for InterfaceFlags
12
+ pub type IflagsType = libc:: c_int ;
13
+ #[ cfg( solarish) ]
14
+ /// type alias for InterfaceFlags
15
+ pub type IflagsType = libc:: c_longlong ;
16
+
10
17
/// Resolve an interface into a interface number.
11
18
pub fn if_nametoindex < P : ?Sized + NixPath > ( name : & P ) -> Result < c_uint > {
12
19
let if_index = name
@@ -21,23 +28,24 @@ pub fn if_nametoindex<P: ?Sized + NixPath>(name: &P) -> Result<c_uint> {
21
28
22
29
libc_bitflags ! (
23
30
/// Standard interface flags, used by `getifaddrs`
24
- pub struct InterfaceFlags : libc:: c_int {
31
+ pub struct InterfaceFlags : IflagsType {
32
+
25
33
/// Interface is running. (see
26
34
/// [`netdevice(7)`](https://man7.org/linux/man-pages/man7/netdevice.7.html))
27
- IFF_UP ;
35
+ IFF_UP as IflagsType ;
28
36
/// Valid broadcast address set. (see
29
37
/// [`netdevice(7)`](https://man7.org/linux/man-pages/man7/netdevice.7.html))
30
- IFF_BROADCAST ;
38
+ IFF_BROADCAST as IflagsType ;
31
39
/// Internal debugging flag. (see
32
40
/// [`netdevice(7)`](https://man7.org/linux/man-pages/man7/netdevice.7.html))
33
41
#[ cfg( not( target_os = "haiku" ) ) ]
34
- IFF_DEBUG ;
42
+ IFF_DEBUG as IflagsType ;
35
43
/// Interface is a loopback interface. (see
36
44
/// [`netdevice(7)`](https://man7.org/linux/man-pages/man7/netdevice.7.html))
37
- IFF_LOOPBACK ;
45
+ IFF_LOOPBACK as IflagsType ;
38
46
/// Interface is a point-to-point link. (see
39
47
/// [`netdevice(7)`](https://man7.org/linux/man-pages/man7/netdevice.7.html))
40
- IFF_POINTOPOINT ;
48
+ IFF_POINTOPOINT as IflagsType ;
41
49
/// Avoid use of trailers. (see
42
50
/// [`netdevice(7)`](https://man7.org/linux/man-pages/man7/netdevice.7.html))
43
51
#[ cfg( any(
@@ -46,27 +54,27 @@ libc_bitflags!(
46
54
apple_targets,
47
55
target_os = "fuchsia" ,
48
56
target_os = "netbsd" ) ) ]
49
- IFF_NOTRAILERS ;
57
+ IFF_NOTRAILERS as IflagsType ;
50
58
/// Interface manages own routes.
51
59
#[ cfg( any( target_os = "dragonfly" ) ) ]
52
- IFF_SMART ;
60
+ IFF_SMART as IflagsType ;
53
61
/// Resources allocated. (see
54
62
/// [`netdevice(7)`](https://man7.org/linux/man-pages/man7/netdevice.7.html))
55
63
#[ cfg( any(
56
64
linux_android,
57
65
bsd,
58
66
solarish,
59
67
target_os = "fuchsia" ) ) ]
60
- IFF_RUNNING ;
68
+ IFF_RUNNING as IflagsType ;
61
69
/// No arp protocol, L2 destination address not set. (see
62
70
/// [`netdevice(7)`](https://man7.org/linux/man-pages/man7/netdevice.7.html))
63
- IFF_NOARP ;
71
+ IFF_NOARP as IflagsType ;
64
72
/// Interface is in promiscuous mode. (see
65
73
/// [`netdevice(7)`](https://man7.org/linux/man-pages/man7/netdevice.7.html))
66
- IFF_PROMISC ;
74
+ IFF_PROMISC as IflagsType ;
67
75
/// Receive all multicast packets. (see
68
76
/// [`netdevice(7)`](https://man7.org/linux/man-pages/man7/netdevice.7.html))
69
- IFF_ALLMULTI ;
77
+ IFF_ALLMULTI as IflagsType ;
70
78
/// Master of a load balancing bundle. (see
71
79
/// [`netdevice(7)`](https://man7.org/linux/man-pages/man7/netdevice.7.html))
72
80
#[ cfg( any( linux_android, target_os = "fuchsia" ) ) ]
@@ -76,7 +84,7 @@ libc_bitflags!(
76
84
IFF_OACTIVE ;
77
85
/// Protocol code on board.
78
86
#[ cfg( solarish) ]
79
- IFF_INTELLIGENT ;
87
+ IFF_INTELLIGENT as IflagsType ;
80
88
/// Slave of a load balancing bundle. (see
81
89
/// [`netdevice(7)`](https://man7.org/linux/man-pages/man7/netdevice.7.html))
82
90
#[ cfg( any( linux_android, target_os = "fuchsia" ) ) ]
@@ -86,13 +94,13 @@ libc_bitflags!(
86
94
IFF_SIMPLEX ;
87
95
/// Supports multicast. (see
88
96
/// [`netdevice(7)`](https://man7.org/linux/man-pages/man7/netdevice.7.html))
89
- IFF_MULTICAST ;
97
+ IFF_MULTICAST as IflagsType ;
90
98
/// Per link layer defined bit.
91
99
#[ cfg( bsd) ]
92
100
IFF_LINK0 ;
93
101
/// Multicast using broadcast.
94
102
#[ cfg( solarish) ]
95
- IFF_MULTI_BCAST ;
103
+ IFF_MULTI_BCAST as IflagsType ;
96
104
/// Is able to select media type via ifmap. (see
97
105
/// [`netdevice(7)`](https://man7.org/linux/man-pages/man7/netdevice.7.html))
98
106
#[ cfg( any( linux_android, target_os = "fuchsia" ) ) ]
@@ -102,7 +110,7 @@ libc_bitflags!(
102
110
IFF_LINK1 ;
103
111
/// Non-unique address.
104
112
#[ cfg( solarish) ]
105
- IFF_UNNUMBERED ;
113
+ IFF_UNNUMBERED as IflagsType ;
106
114
/// Auto media selection active. (see
107
115
/// [`netdevice(7)`](https://man7.org/linux/man-pages/man7/netdevice.7.html))
108
116
#[ cfg( any( linux_android, target_os = "fuchsia" ) ) ]
@@ -115,14 +123,14 @@ libc_bitflags!(
115
123
IFF_ALTPHYS ;
116
124
/// DHCP controls interface.
117
125
#[ cfg( solarish) ]
118
- IFF_DHCPRUNNING ;
126
+ IFF_DHCPRUNNING as IflagsType ;
119
127
/// The addresses are lost when the interface goes down. (see
120
128
/// [`netdevice(7)`](https://man7.org/linux/man-pages/man7/netdevice.7.html))
121
129
#[ cfg( any( linux_android, target_os = "fuchsia" ) ) ]
122
130
IFF_DYNAMIC ;
123
131
/// Do not advertise.
124
132
#[ cfg( solarish) ]
125
- IFF_PRIVATE ;
133
+ IFF_PRIVATE as IflagsType ;
126
134
/// Driver signals L1 up. Volatile.
127
135
#[ cfg( any( target_os = "fuchsia" , target_os = "linux" ) ) ]
128
136
IFF_LOWER_UP ;
@@ -134,7 +142,7 @@ libc_bitflags!(
134
142
IFF_CANTCONFIG ;
135
143
/// Do not transmit packets.
136
144
#[ cfg( solarish) ]
137
- IFF_NOXMIT ;
145
+ IFF_NOXMIT as IflagsType ;
138
146
/// Driver signals dormant. Volatile.
139
147
#[ cfg( any( target_os = "fuchsia" , target_os = "linux" ) ) ]
140
148
IFF_DORMANT ;
@@ -143,7 +151,7 @@ libc_bitflags!(
143
151
IFF_PPROMISC ;
144
152
/// Just on-link subnet.
145
153
#[ cfg( solarish) ]
146
- IFF_NOLOCAL ;
154
+ IFF_NOLOCAL as IflagsType ;
147
155
/// Echo sent packets. Volatile.
148
156
#[ cfg( any( target_os = "fuchsia" , target_os = "linux" ) ) ]
149
157
IFF_ECHO ;
@@ -152,19 +160,19 @@ libc_bitflags!(
152
160
IFF_MONITOR ;
153
161
/// Address is deprecated.
154
162
#[ cfg( solarish) ]
155
- IFF_DEPRECATED ;
163
+ IFF_DEPRECATED as IflagsType ;
156
164
/// Static ARP.
157
165
#[ cfg( freebsdlike) ]
158
166
IFF_STATICARP ;
159
167
/// Address from stateless addrconf.
160
168
#[ cfg( solarish) ]
161
- IFF_ADDRCONF ;
169
+ IFF_ADDRCONF as IflagsType ;
162
170
/// Interface is in polling mode.
163
171
#[ cfg( any( target_os = "dragonfly" ) ) ]
164
172
IFF_NPOLLING ;
165
173
/// Router on interface.
166
174
#[ cfg( solarish) ]
167
- IFF_ROUTER ;
175
+ IFF_ROUTER as IflagsType ;
168
176
/// Interface is in polling mode.
169
177
#[ cfg( any( target_os = "dragonfly" ) ) ]
170
178
IFF_IDIRECT ;
@@ -173,66 +181,67 @@ libc_bitflags!(
173
181
IFF_DYING ;
174
182
/// No NUD on interface.
175
183
#[ cfg( solarish) ]
176
- IFF_NONUD ;
184
+ IFF_NONUD as IflagsType ;
177
185
/// Interface is being renamed
178
186
#[ cfg( any( target_os = "freebsd" ) ) ]
179
187
IFF_RENAMING ;
180
188
/// Anycast address.
181
189
#[ cfg( solarish) ]
182
- IFF_ANYCAST ;
190
+ IFF_ANYCAST as IflagsType ;
183
191
/// Don't exchange routing info.
184
192
#[ cfg( solarish) ]
185
- IFF_NORTEXCH ;
193
+ IFF_NORTEXCH as IflagsType ;
186
194
/// Do not provide packet information
187
195
#[ cfg( any( linux_android, target_os = "fuchsia" ) ) ]
188
- IFF_NO_PI as libc :: c_int ;
196
+ IFF_NO_PI as IflagsType ;
189
197
/// TUN device (no Ethernet headers)
190
198
#[ cfg( any( linux_android, target_os = "fuchsia" ) ) ]
191
- IFF_TUN as libc :: c_int ;
199
+ IFF_TUN as IflagsType ;
192
200
/// TAP device
193
201
#[ cfg( any( linux_android, target_os = "fuchsia" ) ) ]
194
- IFF_TAP as libc :: c_int ;
202
+ IFF_TAP as IflagsType ;
195
203
/// IPv4 interface.
196
204
#[ cfg( solarish) ]
197
- IFF_IPV4 ;
205
+ IFF_IPV4 as IflagsType ;
198
206
/// IPv6 interface.
199
207
#[ cfg( solarish) ]
200
- IFF_IPV6 ;
208
+ IFF_IPV6 as IflagsType ;
201
209
/// in.mpathd test address
202
210
#[ cfg( solarish) ]
203
- IFF_NOFAILOVER ;
211
+ IFF_NOFAILOVER as IflagsType ;
204
212
/// Interface has failed
205
213
#[ cfg( solarish) ]
206
- IFF_FAILED ;
214
+ IFF_FAILED as IflagsType ;
207
215
/// Interface is a hot-spare
208
216
#[ cfg( solarish) ]
209
- IFF_STANDBY ;
217
+ IFF_STANDBY as IflagsType ;
210
218
/// Functioning but not used
211
219
#[ cfg( solarish) ]
212
- IFF_INACTIVE ;
220
+ IFF_INACTIVE as IflagsType ;
213
221
/// Interface is offline
214
222
#[ cfg( solarish) ]
215
- IFF_OFFLINE ;
216
- #[ cfg( target_os = "solaris" ) ]
217
- IFF_COS_ENABLED ;
218
- /// Prefer as source addr.
219
- #[ cfg( target_os = "solaris" ) ]
220
- IFF_PREFERRED ;
223
+ IFF_OFFLINE as IflagsType ;
224
+ /// Has CoS marking supported
225
+ #[ cfg( solarish) ]
226
+ IFF_COS_ENABLED as IflagsType ;
227
+ /// Prefer as source addr
228
+ #[ cfg( solarish) ]
229
+ IFF_PREFERRED as IflagsType ;
221
230
/// RFC3041
222
- #[ cfg( target_os = "solaris" ) ]
223
- IFF_TEMPORARY ;
224
- /// MTU set with SIOCSLIFMTU
225
- #[ cfg( target_os = "solaris" ) ]
226
- IFF_FIXEDMTU ;
227
- /// Cannot send / receive packets
228
- #[ cfg( target_os = "solaris" ) ]
229
- IFF_VIRTUAL ;
231
+ #[ cfg( solarish ) ]
232
+ IFF_TEMPORARY as IflagsType ;
233
+ /// MTU set
234
+ #[ cfg( solarish ) ]
235
+ IFF_FIXEDMTU as IflagsType ;
236
+ /// Cannot send/ receive packets
237
+ #[ cfg( solarish ) ]
238
+ IFF_VIRTUAL as IflagsType ;
230
239
/// Local address in use
231
- #[ cfg( target_os = "solaris" ) ]
232
- IFF_DUPLICATE ;
240
+ #[ cfg( solarish ) ]
241
+ IFF_DUPLICATE as IflagsType ;
233
242
/// IPMP IP interface
234
- #[ cfg( target_os = "solaris" ) ]
235
- IFF_IPMP ;
243
+ #[ cfg( solarish ) ]
244
+ IFF_IPMP as IflagsType ;
236
245
}
237
246
) ;
238
247
@@ -247,7 +256,7 @@ impl fmt::Display for InterfaceFlags {
247
256
bsd,
248
257
target_os = "fuchsia" ,
249
258
target_os = "linux" ,
250
- target_os = "illumos" ,
259
+ solarish ,
251
260
) ) ]
252
261
mod if_nameindex {
253
262
use super :: * ;
@@ -374,6 +383,6 @@ mod if_nameindex {
374
383
bsd,
375
384
target_os = "fuchsia" ,
376
385
target_os = "linux" ,
377
- target_os = "illumos" ,
386
+ solarish ,
378
387
) ) ]
379
388
pub use if_nameindex:: * ;
0 commit comments