Skip to content

Commit 149ddd8

Browse files
stephen hemmingerdavem330
stephen hemminger
authored andcommitted
bridge: Assign rtnl_link_ops to bridge devices created via ioctl (v2)
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> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent d7ffde3 commit 149ddd8

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

net/bridge/br_if.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ int br_add_bridge(struct net *net, const char *name)
240240
return -ENOMEM;
241241

242242
dev_net_set(dev, net);
243+
dev->rtnl_link_ops = &br_link_ops;
243244

244245
res = register_netdev(dev);
245246
if (res)

net/bridge/br_netlink.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ static int br_validate(struct nlattr *tb[], struct nlattr *data[])
208208
return 0;
209209
}
210210

211-
static struct rtnl_link_ops br_link_ops __read_mostly = {
211+
struct rtnl_link_ops br_link_ops __read_mostly = {
212212
.kind = "bridge",
213213
.priv_size = sizeof(struct net_bridge),
214214
.setup = br_dev_setup,

net/bridge/br_private.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,7 @@ extern int (*br_fdb_test_addr_hook)(struct net_device *dev, unsigned char *addr)
549549
#endif
550550

551551
/* br_netlink.c */
552+
extern struct rtnl_link_ops br_link_ops;
552553
extern int br_netlink_init(void);
553554
extern void br_netlink_fini(void);
554555
extern void br_ifinfo_notify(int event, struct net_bridge_port *port);

0 commit comments

Comments
 (0)