* [PATCHv2] cfg/nl80211: send CMD_INTERFACE event on NETDEV_UNREGISTER
@ 2013-08-08 23:24 Antonio Quartulli
2013-08-09 6:56 ` Johannes Berg
0 siblings, 1 reply; 3+ messages in thread
From: Antonio Quartulli @ 2013-08-08 23:24 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, Antonio Quartulli
From: Antonio Quartulli <antonio@open-mesh.com>
Userspace applications may be listening for events (e.g.
matching mgmt frame) on a given interface. If such interface
is deleted they would keep hanging because no event will be
delivered anymore.
Send a CMD_INTERFACE event on NETDEV_UNREGISTER to notify
userspace that the interface does not exist anymore.
Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
---
net/wireless/core.c | 2 ++
net/wireless/nl80211.c | 31 +++++++++++++++++++++++++++++++
net/wireless/nl80211.h | 3 +++
3 files changed, 36 insertions(+)
diff --git a/net/wireless/core.c b/net/wireless/core.c
index 389a3f2..ae4c148 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -913,6 +913,8 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
}
break;
case NETDEV_UNREGISTER:
+ nl80211_send_del_iface(rdev, dev, GFP_KERNEL);
+
/*
* It is possible to get NETDEV_UNREGISTER
* multiple times. To detect that, check
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index f7cb121..61be4ea 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -10022,6 +10022,37 @@ void nl80211_send_disconnected(struct cfg80211_registered_device *rdev,
}
+void nl80211_send_del_iface(struct cfg80211_registered_device *rdev,
+ struct net_device *netdev, gfp_t gfp)
+{
+ struct sk_buff *msg;
+ void *hdr;
+
+ msg = nlmsg_new(NLMSG_DEFAULT_SIZE, gfp);
+ if (!msg)
+ return;
+
+ hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_DEL_INTERFACE);
+ if (!hdr) {
+ nlmsg_free(msg);
+ return;
+ }
+
+ if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) ||
+ nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex))
+ goto nla_put_failure;
+
+ genlmsg_end(msg, hdr);
+
+ genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0,
+ nl80211_mlme_mcgrp.id, gfp);
+ return;
+
+ nla_put_failure:
+ genlmsg_cancel(msg, hdr);
+ nlmsg_free(msg);
+}
+
void nl80211_send_ibss_bssid(struct cfg80211_registered_device *rdev,
struct net_device *netdev, const u8 *bssid,
gfp_t gfp)
diff --git a/net/wireless/nl80211.h b/net/wireless/nl80211.h
index 44341bf..6071557 100644
--- a/net/wireless/nl80211.h
+++ b/net/wireless/nl80211.h
@@ -59,6 +59,9 @@ nl80211_send_beacon_hint_event(struct wiphy *wiphy,
struct ieee80211_channel *channel_before,
struct ieee80211_channel *channel_after);
+void nl80211_send_del_iface(struct cfg80211_registered_device *rdev,
+ struct net_device *netdev, gfp_t gfp);
+
void nl80211_send_ibss_bssid(struct cfg80211_registered_device *rdev,
struct net_device *netdev, const u8 *bssid,
gfp_t gfp);
--
1.8.1.5
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCHv2] cfg/nl80211: send CMD_INTERFACE event on NETDEV_UNREGISTER
2013-08-08 23:24 [PATCHv2] cfg/nl80211: send CMD_INTERFACE event on NETDEV_UNREGISTER Antonio Quartulli
@ 2013-08-09 6:56 ` Johannes Berg
2013-08-09 7:21 ` Antonio Quartulli
0 siblings, 1 reply; 3+ messages in thread
From: Johannes Berg @ 2013-08-09 6:56 UTC (permalink / raw)
To: Antonio Quartulli; +Cc: linux-wireless, Antonio Quartulli
On Fri, 2013-08-09 at 01:24 +0200, Antonio Quartulli wrote:
> From: Antonio Quartulli <antonio@open-mesh.com>
>
> Userspace applications may be listening for events (e.g.
> matching mgmt frame) on a given interface. If such interface
> is deleted they would keep hanging because no event will be
> delivered anymore.
>
> Send a CMD_INTERFACE event on NETDEV_UNREGISTER to notify
> userspace that the interface does not exist anymore.
This is too slippery a slope for me, I'm not going to apply this. You
can listen to normal interface events in rtnetlink.
johannes
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCHv2] cfg/nl80211: send CMD_INTERFACE event on NETDEV_UNREGISTER
2013-08-09 6:56 ` Johannes Berg
@ 2013-08-09 7:21 ` Antonio Quartulli
0 siblings, 0 replies; 3+ messages in thread
From: Antonio Quartulli @ 2013-08-09 7:21 UTC (permalink / raw)
To: Johannes Berg; +Cc: Antonio Quartulli, linux-wireless@vger.kernel.org
[-- Attachment #1: Type: text/plain, Size: 933 bytes --]
On Thu, Aug 08, 2013 at 11:56:33PM -0700, Johannes Berg wrote:
> On Fri, 2013-08-09 at 01:24 +0200, Antonio Quartulli wrote:
> > From: Antonio Quartulli <antonio@open-mesh.com>
> >
> > Userspace applications may be listening for events (e.g.
> > matching mgmt frame) on a given interface. If such interface
> > is deleted they would keep hanging because no event will be
> > delivered anymore.
> >
> > Send a CMD_INTERFACE event on NETDEV_UNREGISTER to notify
> > userspace that the interface does not exist anymore.
>
> This is too slippery a slope for me, I'm not going to apply this. You
> can listen to normal interface events in rtnetlink.
Mh, ok. Even if it is strange that an nl80211 socket does not get any
notification on interface deletion.
But yes, I'll listen for rtnl events. Thanks for the hint.
Cheers,
--
Antonio Quartulli
..each of us alone is worth nothing..
Ernesto "Che" Guevara
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-08-09 7:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-08 23:24 [PATCHv2] cfg/nl80211: send CMD_INTERFACE event on NETDEV_UNREGISTER Antonio Quartulli
2013-08-09 6:56 ` Johannes Berg
2013-08-09 7:21 ` Antonio Quartulli
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).