little-dude / netlink

netlink libraries for rust
Other
328 stars 89 forks source link

rtnetlink: LinkDelRequest broken on kernel v5.19 #273

Closed Luap99 closed 2 years ago

Luap99 commented 2 years ago

The LinkDelRequest sets the following flags: https://github.com/little-dude/netlink/blob/15324923e655a5c786a23cbe88b5d523c46a2f3b/rtnetlink/src/link/del.rs#L39

From netlink(7): NLM_F_EXCL and NLM_F_CREATE are only valid for NEW requests. The problem is that kernel 5.19 added a new DELETE flag NLM_F_BULK which has the same value as NLM_F_EXCL, so now the delete requests fail with EOPNOTSUPP.

Here is the flag list from the kernel: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/netlink.h#n52

To fix this we should only set NLM_F_REQUEST and NLM_F_ACK for a delete request. I will submit a PR.