2018-10-19 02:37:34

by Andrew Zaborowski

[permalink] [raw]
Subject: [PATCH] nl80211: Emit a NEW_INTERFACE on iftype change

Let userspace learn about iftype changes by sending an
NL80211_CMD_NEW_INTERFACE when handling a NL80211_CMD_SET_INTERFACE
command. There seems to be no other place where the iftype can change:
nl80211_set_interface is the only caller of cfg80211_change_iface which
is the only caller of ops->change_virtual_intf.

Signed-off-by: Andrew Zaborowski <[email protected]>
---
net/wireless/nl80211.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index ac08ba5f0a..7b6b214bb4 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -3165,6 +3165,12 @@ static int nl80211_set_interface(struct sk_buff *skb, struct genl_info *info)
if (!err && params.use_4addr != -1)
dev->ieee80211_ptr->use_4addr = params.use_4addr;

+ if (change && !err) {
+ struct wireless_dev *wdev = dev->ieee80211_ptr;
+
+ nl80211_notify_iface(rdev, wdev, NL80211_CMD_NEW_INTERFACE);
+ }
+
return err;
}

--
2.19.1



2018-10-19 06:48:33

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH] nl80211: Emit a NEW_INTERFACE on iftype change

On Fri, 2018-10-19 at 04:37 +0200, Andrew Zaborowski wrote:
> Let userspace learn about iftype changes by sending an
> NL80211_CMD_NEW_INTERFACE when handling a NL80211_CMD_SET_INTERFACE
> command. There seems to be no other place where the iftype can change:
> nl80211_set_interface is the only caller of cfg80211_change_iface which
> is the only caller of ops->change_virtual_intf.

Why not use SET_INTERFACE? I think I'd be more comfortable with that,
since it's not really used now and existing userspace might do weird
things with NEW_INTERFACE?

johannes


2018-10-19 20:30:09

by Andrew Zaborowski

[permalink] [raw]
Subject: Re: [PATCH] nl80211: Emit a NEW_INTERFACE on iftype change

On Fri, 19 Oct 2018 at 08:48, Johannes Berg <[email protected]> wrote:
> On Fri, 2018-10-19 at 04:37 +0200, Andrew Zaborowski wrote:
> > Let userspace learn about iftype changes by sending an
> > NL80211_CMD_NEW_INTERFACE when handling a NL80211_CMD_SET_INTERFACE
> > command. There seems to be no other place where the iftype can change:
> > nl80211_set_interface is the only caller of cfg80211_change_iface which
> > is the only caller of ops->change_virtual_intf.
>
> Why not use SET_INTERFACE? I think I'd be more comfortable with that,
> since it's not really used now and existing userspace might do weird
> things with NEW_INTERFACE?

True, let's use SET_INTERFACE then.

Best regards