-
Notifications
You must be signed in to change notification settings - Fork 47
Description
Would adding this feature cause a breaking change?
I'm not sure, but hopefully no?
Is your feature request related to a problem? Please describe.
NlattrType impl is only supported for u16 serialized type enums. However, there are several non-u16 attributes in the nl80211 generic Netlink specification (all u32 that I can tell from work I've done recently).
While defining these actually u32 attributes as u16 may permit usage for parsing messages received from the kernel module (e.g. nested attributes), this workaround can prevent usage when sending messages to the kernel module.
I have specifically seen this when defining/using the nested enum nl80211_iftype u32 attr enum. When attempting to add a new interface with the u16 workaround, the kernel returns an error message complaining about invalid length. Wireshark netlink capture confirms this and working case using the iw tool shows success with the correct length.
Describe the solution you'd like
Added support for arbitrary unsigned integer type serialized type enums, specifically u32.
Additional context
Example where the actual type is u32, but only defining as u16 will compile:
/// Virtual interface types
// TODO: This is actually a u32, but compiler won't allow anything but u16 for Nlattr
#[neli_enum(serialized_type = "u16")]
pub enum Nl80211IfType {
/// Unspecified type, driver decides
Unspecified = nl80211_iftype::NL80211_IFTYPE_UNSPECIFIED as u16,
...
/// NAN device interface type (not a netdev)
Nan = nl80211_iftype::NL80211_IFTYPE_NAN as u16,
}
impl neli::consts::genl::NlAttrType for Nl80211IfType {}