Patchwork bridge: Assign rtnl_link_ops to bridge devices created via ioctl (v2)

login
register
mail settings
Submitter stephen hemminger
Date June 26, 2012, 3:48 p.m.
Message ID <20120626084845.0578fcb8@nehalam.linuxnetplumber.net>
Download mbox | patch
Permalink /patch/167422/
State Accepted
Delegated to: David Miller
Headers show

Comments

stephen hemminger - June 26, 2012, 3:48 p.m.
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>
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

---
v2 - Minor change to Thomas's original patch.
This is a bug fix, should go to stable as well.

 net/bridge/br_if.c      |    1 +
 net/bridge/br_netlink.c |    2 +-
 net/bridge/br_private.h |    1 +
 3 files changed, 3 insertions(+), 1 deletion(-)

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - June 27, 2012, 4:13 a.m.
From: Stephen Hemminger <shemminger@vyatta.com>
Date: Tue, 26 Jun 2012 08:48:45 -0700

> 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>
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> 
> ---
> v2 - Minor change to Thomas's original patch.
> This is a bug fix, should go to stable as well.

Applied and queued up for -stable, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

--- a/net/bridge/br_netlink.c	2012-06-26 08:07:18.459760113 -0700
+++ b/net/bridge/br_netlink.c	2012-06-26 08:30:16.729918150 -0700
@@ -208,7 +208,7 @@  static int br_validate(struct nlattr *tb
 	return 0;
 }
 
-static struct rtnl_link_ops br_link_ops __read_mostly = {
+struct rtnl_link_ops br_link_ops __read_mostly = {
 	.kind		= "bridge",
 	.priv_size	= sizeof(struct net_bridge),
 	.setup		= br_dev_setup,
--- a/net/bridge/br_private.h	2012-06-26 08:07:18.459760113 -0700
+++ b/net/bridge/br_private.h	2012-06-26 08:30:16.729918150 -0700
@@ -549,6 +549,7 @@  extern int (*br_fdb_test_addr_hook)(stru
 #endif
 
 /* br_netlink.c */
+extern struct rtnl_link_ops br_link_ops;
 extern int br_netlink_init(void);
 extern void br_netlink_fini(void);
 extern void br_ifinfo_notify(int event, struct net_bridge_port *port);
--- a/net/bridge/br_if.c	2012-06-26 08:07:18.459760113 -0700
+++ b/net/bridge/br_if.c	2012-06-26 08:30:37.653708011 -0700
@@ -240,6 +240,7 @@  int br_add_bridge(struct net *net, const
 		return -ENOMEM;
 
 	dev_net_set(dev, net);
+	dev->rtnl_link_ops = &br_link_ops;
 
 	res = register_netdev(dev);
 	if (res)