Skip to content
This repository has been archived by the owner on Oct 26, 2022. It is now read-only.

LinkGetRequest using Nla::NetNsFd does not list interfaces in a namespace #277

Open
pdtilton opened this issue Jul 15, 2022 · 0 comments
Open

Comments

@pdtilton
Copy link

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant