From: Johannes Berg <johannes@sipsolutions.net>
To: linux-wireless@vger.kernel.org
Subject: [RFT 1/4] net: introduce pre-up netdev notifier
Date: Thu, 21 May 2009 23:59:41 +0200 [thread overview]
Message-ID: <20090521220104.755267733@sipsolutions.net> (raw)
In-Reply-To: 20090521215940.344214804@sipsolutions.net
NETDEV_UP is called after the device is set UP, but sometimes
it is useful to be able to veto the device UP. Introduce a
new NETDEV_PRE_UP notifier that can be used for exactly this.
The first use case will be cfg80211 denying interfaces to be
set UP if the device is known to be rfkill'ed.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
John, please take this patch via your tree, I asked Dave and
he's cool with that.
include/linux/notifier.h | 1 +
net/core/dev.c | 7 ++++++-
2 files changed, 7 insertions(+), 1 deletion(-)
--- wireless-testing.orig/include/linux/notifier.h 2009-05-21 21:17:29.000000000 +0200
+++ wireless-testing/include/linux/notifier.h 2009-05-21 21:17:44.000000000 +0200
@@ -198,6 +198,7 @@ static inline int notifier_to_errno(int
#define NETDEV_CHANGENAME 0x000A
#define NETDEV_FEAT_CHANGE 0x000B
#define NETDEV_BONDING_FAILOVER 0x000C
+#define NETDEV_PRE_UP 0x000D
#define SYS_DOWN 0x0001 /* Notify of system down */
#define SYS_RESTART SYS_DOWN
--- wireless-testing.orig/net/core/dev.c 2009-05-21 21:17:48.000000000 +0200
+++ wireless-testing/net/core/dev.c 2009-05-21 21:18:51.000000000 +0200
@@ -1047,7 +1047,7 @@ void dev_load(struct net *net, const cha
int dev_open(struct net_device *dev)
{
const struct net_device_ops *ops = dev->netdev_ops;
- int ret = 0;
+ int ret;
ASSERT_RTNL();
@@ -1064,6 +1064,11 @@ int dev_open(struct net_device *dev)
if (!netif_device_present(dev))
return -ENODEV;
+ ret = call_netdevice_notifiers(NETDEV_PRE_UP, dev);
+ ret = notifier_to_errno(ret);
+ if (ret)
+ return ret;
+
/*
* Call device private open method
*/
--
next prev parent reply other threads:[~2009-05-21 22:02 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-21 21:59 [RFT 0/4] rfkill improvements Johannes Berg
2009-05-21 21:59 ` Johannes Berg [this message]
2009-05-21 21:59 ` [RFT 2/4] rfkill: add function to query state Johannes Berg
2009-05-21 21:59 ` [RFT 3/4] cfg80211: add rfkill support Johannes Berg
2009-05-23 9:52 ` [RFT 3/4 v2] " Johannes Berg
2009-05-24 13:32 ` [RFT 3/4] " Dan Williams
2009-05-24 17:24 ` Johannes Berg
2009-05-26 16:38 ` Marcel Holtmann
2009-05-21 21:59 ` [RFT 4/4] iwlwifi: port to cfg80211 rfkill Johannes Berg
2009-05-23 8:49 ` [RFT 4/4 v2] " Johannes Berg
2009-05-23 8:52 ` [RFT 5/4] iwm: port to new " Johannes Berg
2009-05-25 1:22 ` Zhu Yi
2009-05-25 5:13 ` Johannes Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090521220104.755267733@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).