Closed pktpls closed 1 year ago
Btw I noticed that the IFLA_NETNS_PID
spec attribute is commented out, I assume because it doesn't work yet? I think it has a typo and should be called IFLA_NET_NS_PID
, there's also an equivalent for /var/run/netns/ file descriptors called IFLA_NET_NS_FD
.
I don't exactly remember why I left this attribute commented out, I think because I thought it entails more work than just passing through the integer value as-is, but maybe I was mistaken.
If you have a use-case for it and are able to test it out then I'd appreciate a patch implementing it.
Btw, upstream renamed IFLA_IF_NETNSID
to IFLA_TARGET_NETNSID
- maybe it makes sense to go with the new attribute name right away?
Ah yes I noticed that, but thought it was the other way around. It makes sense, I'll test and push.
And I do actually have a use-case for IFLA_NET_NS_PID - moving an interface from a custom namespace into the default namespace, which is usually identified by PID 1.
I'll get back to you with that.
Okay let's leave it at only IFLA_TARGET_NETNSID for now :-)
I noticed that the combination of IFLA_TARGET_NETNSID and IFLA_NET_NS_PID (or _FD) actually isn't supported yet (which is what I wanted to try and test). There was a kernel patch proposed in 2019 to allow it, but it stalled.
But I will probably eventually get to testing IFLA_NET_NS_PID and _FD on their own.
IFLA_IF_NETNSID allows RTM_GETLINK et. al. to operate in other network namespaces. For example I use it to check if a given interface exists in a given namespace.
The nsid is set with
ip netns set <nsname> <nsid>
and obtained withip -j netns list-id
.