@@ -193,18 +193,16 @@ impl<'a, T: AsRef<[u8]> + ?Sized>
193
193
let msg = match RouteMessageBuffer :: new_checked ( & buf. inner ( ) ) {
194
194
Ok ( buf) => RouteMessage :: parse ( & buf)
195
195
. context ( "invalid route message" ) ?,
196
- // HACK: iproute2 sends invalid RTM_GETROUTE message, where
197
- // the header is limited to the
198
- // interface family (1 byte) and 3 bytes of padding.
196
+ // HACK: iproute2 sends an invalid RTM_GETROUTE message,
197
+ // where the header is limited to the interface family
198
+ // (1 byte) and 3 bytes of padding.
199
199
Err ( e) => {
200
- // Not only does iproute2 sends invalid messages, it's
201
- // also inconsistent in
202
- // doing so: for link and address messages, the length
203
- // advertised in the
204
- // netlink header includes the 3 bytes of padding but it
205
- // does not seem to be the case
206
- // for the route message, hence the buf.length() == 1
207
- // check.
200
+ // Not only does iproute2 send invalid messages, it's
201
+ // also inconsistent in doing so: for link and address
202
+ // messages, the length advertised in the netlink header
203
+ // includes the 3 bytes of padding, but it does not seem
204
+ // to be the case for the route message, hence the
205
+ // `buf.length() == 1` check.
208
206
if ( buf. inner ( ) . len ( ) == 4 || buf. inner ( ) . len ( ) == 1 )
209
207
&& message_type == RTM_GETROUTE
210
208
{
@@ -253,6 +251,7 @@ impl<'a, T: AsRef<[u8]> + ?Sized>
253
251
_ => unreachable ! ( ) ,
254
252
}
255
253
}
254
+
256
255
// TC Messages
257
256
RTM_NEWQDISC | RTM_DELQDISC | RTM_GETQDISC | RTM_NEWTCLASS
258
257
| RTM_DELTCLASS | RTM_GETTCLASS | RTM_NEWTFILTER
@@ -292,13 +291,13 @@ impl<'a, T: AsRef<[u8]> + ?Sized>
292
291
}
293
292
}
294
293
294
+ // TC action messages
295
295
RTM_NEWACTION | RTM_DELACTION | RTM_GETACTION => {
296
- let err = "invalid tc action message" ;
297
296
let msg = TcActionMessage :: parse (
298
297
& TcActionMessageBuffer :: new_checked ( & buf. inner ( ) )
299
- . context ( err ) ?,
298
+ . context ( "invalid tc action message buffer" ) ?,
300
299
)
301
- . context ( err ) ?;
300
+ . context ( "invalid tc action message" ) ?;
302
301
match message_type {
303
302
RTM_NEWACTION => RouteNetlinkMessage :: NewTrafficAction ( msg) ,
304
303
RTM_DELACTION => RouteNetlinkMessage :: DelTrafficAction ( msg) ,
0 commit comments