mdlayher / netlink

Package netlink provides low-level access to Linux netlink sockets (AF_NETLINK). MIT Licensed.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

netlink: network namespaces can be disabled in kernel configuration

0x5a17ed opened this issue · comments

When I try to use the library in order to open a generic netlink socket I get the error message:

panic: failed to dial: open /proc/self/task/2281/ns/net: no such file or directory

It seems that this library expects a feature to be enabled in my kernel which is not. Do you happen to know which kernel build configuration/feature is responsible for this subdirectory? It might be handy to document this requirement as well.

I don't know which configuration flag would effect this, but I'm surprised network namespaces can apparently be disabled at all.

Since they are not a mandatory part of this package unless you explicitly set one, I'll have to tweak that code path to account for this.

Is procfs enabled at all on that machine? I'm curious if the entire tree is missing or just the parts relevant to the current network namespace.

Procfs is enabled on that system. It's an openwrt based system if it helps. Running Linux 4.14.121

I've pushed a branch mdl-disabled-netns with commit 5d9256f.

I think this will work, but I'd like some more time to figure out how to appropriately test this. It's a bit difficult as I don't think I have any machines that don't support network namespaces. Can you let me know if this works for you?

Can you let me know if this works for you?

works like a charm 👍 :shipit:

Thank you very much for responding and taking care of this issue so fast!

Glad to hear it. Feel free to file an issue if you run into anything else. I also recommend joining #networking on Gophers Slack if you're interested.