netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bridge: Assign rtnl_link_ops to bridge devices created via ioctl()
@ 2012-06-26  8:56 Thomas Graf
  2012-06-26 14:59 ` Stephen Hemminger
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Graf @ 2012-06-26  8:56 UTC (permalink / raw)
  To: davem; +Cc: netdev, shemminger

This ensures that bridges created with brctl(8) or ioctl(2) directly
also carry IFLA_LINKINFO when dumped over netlink. This also allows
to create a bridge with ioctl(2) and delete it with RTM_DELLINK.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
---
 net/bridge/br_if.c      |    1 +
 net/bridge/br_netlink.c |    5 +++++
 net/bridge/br_private.h |    1 +
 3 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 0a942fb..490aae0 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -240,6 +240,7 @@ int br_add_bridge(struct net *net, const char *name)
 		return -ENOMEM;
 
 	dev_net_set(dev, net);
+	br_assign_rtnl_link_ops(dev);
 
 	res = register_netdev(dev);
 	if (res)
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index 2080485..8679b03 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -216,6 +216,11 @@ static struct rtnl_link_ops br_link_ops __read_mostly = {
 	.dellink	= br_dev_delete,
 };
 
+void br_assign_rtnl_link_ops(struct net_device *dev)
+{
+	dev->rtnl_link_ops = &br_link_ops;
+}
+
 int __init br_netlink_init(void)
 {
 	int err;
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index 1a8ad4f..bf205e5 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -552,6 +552,7 @@ extern int (*br_fdb_test_addr_hook)(struct net_device *dev, unsigned char *addr)
 extern int br_netlink_init(void);
 extern void br_netlink_fini(void);
 extern void br_ifinfo_notify(int event, struct net_bridge_port *port);
+extern void br_assign_rtnl_link_ops(struct net_device *dev);
 
 #ifdef CONFIG_SYSFS
 /* br_sysfs_if.c */
-- 
1.7.7.6

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-06-27  4:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-26  8:56 [PATCH] bridge: Assign rtnl_link_ops to bridge devices created via ioctl() Thomas Graf
2012-06-26 14:59 ` Stephen Hemminger
2012-06-26 15:13   ` Thomas Graf
2012-06-26 15:48     ` [PATCH] bridge: Assign rtnl_link_ops to bridge devices created via ioctl (v2) Stephen Hemminger
2012-06-27  4:13       ` David Miller

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).