Commit 8ac7c2a
attribute: fix decoding error on empty IFLA_VFINFO_LIST payload
Using netdevsim driver, it sends empty IFLA_VFINFO_LIST if not
configured. When this happens, the payload length is 0. As we are using
new_checked() function for NlaBuffer creation, we check that the payload
size can allocate the NLA size for that type.
The kernel shouldn't send an empty IFLA_VFINFO_LIST on netdevsim driver
when not configured but until that is fixed, this is a proper solution.
It fixes the following error:
```
thread 'main' panicked at links_dump.rs:62:52:
called `Result::unwrap()` on an `Err` value: DecodeError { inner: Failed to parse message with type 16
Caused by:
Decode error occurred: invalid link message }
```
Signed-off-by: Fernando Fernandez Mancera <[email protected]>1 parent 201d99b commit 8ac7c2a
2 files changed
+30
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
376 | 376 | | |
377 | 377 | | |
378 | 378 | | |
379 | | - | |
380 | | - | |
381 | | - | |
382 | | - | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
383 | 387 | | |
384 | | - | |
385 | | - | |
386 | | - | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
387 | 393 | | |
388 | 394 | | |
389 | 395 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
0 commit comments