Skip to contentSkip to conversation

phy: Allow set netns by fd

RFC In review Vadim Kochan 2 participants 4 messages Jan 23, 2015

lore
Share & tools
lore
#0 lore raw

RFC 1/1 phy: Allow set netns by fd

From: Vadim Kochan <[email protected]>

Added possibility to change network namespace
for phy device by network namespace name from
/var/run/netns or by absolute file path:

iw phy XXX set netns <nsname> | <pid>

First iw tries to find given nsname from /var/run/netns or by absoute path (in case if nsname contains "/") and if it failed to open nsname file then iw uses given argument as <pid>.

Also added missing NL80211 attributes before NL80211_CMD_SET_WIPHY_NETNS.

---
 nl80211.h |  6 ++++++
 phy.c     | 44 ++++++++++++++++++++++++++++++++++++++------
 2 files changed, 44 insertions(+), 6 deletions(-)
nl80211.h +6 -0
index c0383e9..a200a0b 100644
@@ -2072,6 +2072,12 @@ enum nl80211_attrs {
 
 	NL80211_ATTR_WIPHY_SELF_MANAGED_REG,
 
+	NL80211_ATTR_EXT_FEATURES,
+
+	NL80211_ATTR_SURVEY_RADIO_STATS,
+
+	NL80211_ATTR_NETNS_FD,
+
 	/* add attributes here, update the policy in nl80211.c */
 
 	__NL80211_ATTR_AFTER_LAST,
phy.c +38 -6

75 lines not on this page · raw message

Signature · 1 line
2.1.3
#1 lore raw
Quoted 11 lines · Vadim Kochan

From: Vadim Kochan <[email protected]>

Added possibility to change network namespace
for phy device by network namespace name from
/var/run/netns or by absolute file path:

iw phy XXX set netns <nsname> | <pid>

First iw tries to find given nsname from /var/run/netns or by absoute path (in case if nsname contains "/") and if it failed to open nsname file then iw uses given argument as <pid>.

Hmm. I think it'd be better to do something like

iw phy XXX set netns name <nsname>

That way there's no way it can be a valid PID.

Otherwise, if you happen to have a file in your local directory that's the name of the PID you want, weird things happen.

Quoted 1 line

Also added missing NL80211 attributes before NL80211_CMD_SET_WIPHY_NETNS.

Please don't - I'll update nl80211.h by copying as needed.

johannes

#2 lore raw
Quoted 19 lines · Johannes Berg
Quoted 11 lines · Vadim Kochan

From: Vadim Kochan <[email protected]>

Added possibility to change network namespace
for phy device by network namespace name from
/var/run/netns or by absolute file path:

iw phy XXX set netns <nsname> | <pid>

First iw tries to find given nsname from /var/run/netns or by absoute path (in case if nsname contains "/") and if it failed to open nsname file then iw uses given argument as <pid>.

Hmm. I think it'd be better to do something like

iw phy XXX set netns name <nsname>

That way there's no way it can be a valid PID.

Quoted 9 lines

Otherwise, if you happen to have a file in your local directory that's the name of the PID you want, weird things happen.

Quoted 1 line

Also added missing NL80211 attributes before NL80211_CMD_SET_WIPHY_NETNS.

Please don't - I'll update nl80211.h by copying as needed.

johannes

OK, just to clarify with nl80211.h - you will update it including new NL80211_ATTR_NETNS_FD ? If yes - I will wait for this change.

Thanks,

#3 lore raw
Quoted 2 lines · Vadim Kochan

OK, just to clarify with nl80211.h - you will update it including new NL80211_ATTR_NETNS_FD ? If yes - I will wait for this change.

No, don't wait for it - just commit it locally separately for testing, but send me only the actual code changes. I'll then do the update when I apply your patch.

johannes