From: Sven Eckelmann <sven@narfation.org>
To: b.a.t.m.a.n@lists.open-mesh.org
Subject: [B.A.T.M.A.N.] [PATCH-next 3/3] batman-adv: Act on NETDEV_*_TYPE_CHANGE events
Date: Tue, 8 Dec 2015 21:35:58 +0100 [thread overview]
Message-ID: <1449606958-6548-1-git-send-email-sven@narfation.org> (raw)
In-Reply-To: <1449606915-6457-1-git-send-email-sven@narfation.org>
From: Andrew Lunn <andrew@lunn.ch>
A network interface can change type. It may change from a type which
batman does not support, e.g. hdlc, to one it does, e.g. hdlc-eth.
When an interface changes type, it sends two notifications. Handle
these notifications.
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
compat-include/linux/netdevice.h | 3 +++
net/batman-adv/hard-interface.c | 4 +++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/compat-include/linux/netdevice.h b/compat-include/linux/netdevice.h
index 34e5ac7..10253e0 100644
--- a/compat-include/linux/netdevice.h
+++ b/compat-include/linux/netdevice.h
@@ -58,6 +58,9 @@ struct batadv_dev_addr_list {
int da_gusers;
};
+#define NETDEV_PRE_TYPE_CHANGE 0x000E
+#define NETDEV_POST_TYPE_CHANGE 0x000F
+
#endif /* < KERNEL_VERSION(2, 6, 35) */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36)
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index 2d1470f..49e05d2 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -714,7 +714,8 @@ static int batadv_hard_if_event(struct notifier_block *this,
}
hard_iface = batadv_hardif_get_by_netdev(net_dev);
- if (!hard_iface && event == NETDEV_REGISTER)
+ if (!hard_iface && (event == NETDEV_REGISTER ||
+ event == NETDEV_POST_TYPE_CHANGE))
hard_iface = batadv_hardif_add_interface(net_dev);
if (!hard_iface)
@@ -729,6 +730,7 @@ static int batadv_hard_if_event(struct notifier_block *this,
batadv_hardif_deactivate_interface(hard_iface);
break;
case NETDEV_UNREGISTER:
+ case NETDEV_PRE_TYPE_CHANGE:
list_del_rcu(&hard_iface->list);
batadv_hardif_remove_interface(hard_iface);
--
2.6.2
next prev parent reply other threads:[~2015-12-08 20:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-08 20:35 [B.A.T.M.A.N.] [PATCH-next 1/3] net: propagate upper priv via netdev_master_upper_dev_link Sven Eckelmann
2015-12-08 20:35 ` [B.A.T.M.A.N.] [PATCH-next 2/3] net: add possibility to pass information about upper device via notifier Sven Eckelmann
2015-12-13 6:04 ` Marek Lindner
2015-12-08 20:35 ` Sven Eckelmann [this message]
2015-12-13 6:30 ` [B.A.T.M.A.N.] [PATCH-next 3/3] batman-adv: Act on NETDEV_*_TYPE_CHANGE events Marek Lindner
2015-12-13 6:01 ` [B.A.T.M.A.N.] [PATCH-next 1/3] net: propagate upper priv via netdev_master_upper_dev_link Marek Lindner
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=1449606958-6548-1-git-send-email-sven@narfation.org \
--to=sven@narfation.org \
--cc=b.a.t.m.a.n@lists.open-mesh.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