* [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* Re: [PATCH] bridge: Assign rtnl_link_ops to bridge devices created via ioctl()
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
0 siblings, 1 reply; 5+ messages in thread
From: Stephen Hemminger @ 2012-06-26 14:59 UTC (permalink / raw)
To: Thomas Graf; +Cc: davem, netdev
On Tue, 26 Jun 2012 10:56:15 +0200
Thomas Graf <tgraf@suug.ch> wrote:
> +void br_assign_rtnl_link_ops(struct net_device *dev)
> +{
> + dev->rtnl_link_ops = &br_link_ops;
> +}
I am fine with the concept, but maybe it would just be simpler to
make br_link_ops public?
--- a/net/bridge/br_netlink.c 2012-06-22 08:27:50.837126940 -0700
+++ b/net/bridge/br_netlink.c 2012-06-26 07:56:33.510237340 -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-22 08:27:50.837126940 -0700
+++ b/net/bridge/br_private.h 2012-06-26 07:57:25.873711454 -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 07:59:01.996746090 -0700
+++ b/net/bridge/br_if.c 2012-06-26 07:58:55.904807272 -0700
@@ -240,6 +240,7 @@ int br_add_bridge(struct net *net, const
return -ENOMEM;
dev_net_set(dev, net);
+ br->rtnl_link_ops = &br_link_ops;
res = register_netdev(dev);
if (res)
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] bridge: Assign rtnl_link_ops to bridge devices created via ioctl()
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
0 siblings, 1 reply; 5+ messages in thread
From: Thomas Graf @ 2012-06-26 15:13 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: davem, netdev
On Tue, Jun 26, 2012 at 07:59:40AM -0700, Stephen Hemminger wrote:
> On Tue, 26 Jun 2012 10:56:15 +0200
> Thomas Graf <tgraf@suug.ch> wrote:
>
> > +void br_assign_rtnl_link_ops(struct net_device *dev)
> > +{
> > + dev->rtnl_link_ops = &br_link_ops;
> > +}
>
> I am fine with the concept, but maybe it would just be simpler to
> make br_link_ops public?
Either is fine with me. I chose the assignment function to keep the
struct read-only outside of br_netlink.c.
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH] bridge: Assign rtnl_link_ops to bridge devices created via ioctl (v2)
2012-06-26 15:13 ` Thomas Graf
@ 2012-06-26 15:48 ` Stephen Hemminger
2012-06-27 4:13 ` David Miller
0 siblings, 1 reply; 5+ messages in thread
From: Stephen Hemminger @ 2012-06-26 15:48 UTC (permalink / raw)
To: davem; +Cc: Thomas Graf, netdev
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(-)
--- 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)
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] bridge: Assign rtnl_link_ops to bridge devices created via ioctl (v2)
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
0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2012-06-27 4:13 UTC (permalink / raw)
To: shemminger; +Cc: tgraf, netdev
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.
^ permalink raw reply [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).