containernetworking / plugins

Some reference and example networking plugins, maintained by the CNI team.
Apache License 2.0
2.17k stars 778 forks source link

host-device cannot use linux wireless devices #957

Open rfenlon opened 10 months ago

rfenlon commented 10 months ago

When configured to use a wireless device (e.g. wlo1) host-device fails to change the network namespace with an invalid argument response (see netlink/link_linux.go:922). Consider conditionally doing the equivalent of iw phy <my-phy> set netns name <my-namespace> when it's a wireless device.

rfenlon commented 10 months ago

I dug into this a little bit and found that the linux vendor dependency github.com/vishvananda/netlink does not support sending nl80211 messages to netlink. Here is an example of a working netlink request message to change the namespace of a phy using file descriptor for the new network namespace :

-------------------------- BEGIN NETLINK MESSAGE --------------------------- [NETLINK HEADER] 16 octets .nlmsg_len = 36 .type = 32 <0x20> .flags = 5 <REQUEST,ACK> .seq = 1697642139 .port = -2016371064 [GENERIC NETLINK HEADER] 4 octets .cmd = 49 .version = 0 .unused = 0 [PAYLOAD] 16 octets 08 00 01 00 01 00 00 00 08 00 db 00 04 00 00 00 ................ <NL80211_ATTR_WIPHY 0x01> and <NL80211_ATTR_NETNS_FD 0xdb> --------------------------- END NETLINK MESSAGE ---------------------------

I'm not a kernel developer so I'm having trouble finding the following: