netlink
netlink copied to clipboard
LinkGetRequest using Nla::NetNsFd does not list interfaces in a namespace
Using Nla::NetNsFd does not seem to work with LinkGetRequest, but it does work with LinkSetRequest. Is there a supported method for getting all interfaces in a specific network namespace without moving the process into the namespace?
For my test case I added a namespace and create a device within that namespace.
ip netns add foo
ip netns exec foo ip link add dev1 up type bridge
The following snippet first gets the links in the root namespace, then attempts to get the links in the "foo" namespace.
let links = handle.link().get().execute();
//Dumps links in the root namespace
let f = std::fs::File::open("/var/run/netns/foo")?;
let mut get = handle.link().get();
get.message_mut().nlas.push(Nla::NetNsFd(f.as_raw_fd()));
let links = get.execute();
// Also dumps links in the root namespace, but I expect links from the "foo" namespace
I've also tried using Nla::NetnsId
and Nla::IfNetnsId
, with similar results.