aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTheuns Verwoerd <Theuns.Verwoerd@alliedtelesis.co.nz>2017-01-30 18:23:46 -0500
committerDavid S. Miller <davem@davemloft.net>2017-02-01 11:53:23 -0500
commit160ca0142431c19386db976302fd4b07c587f651 (patch)
treee0969dbd871a4e024c1a7cad5ef09474b1d31ac4
parent04cdf13e34e912dcab9a94f391e15b2c26dfd0a2 (diff)
rtnetlink: Handle IFLA_MASTER parameter when processing rtnl_newlink
Allow a master interface to be specified as one of the parameters when creating a new interface via rtnl_newlink. Previously this would require invoking interface creation, waiting for it to complete, and then separately binding that new interface to a master. In particular, this is used when creating a macvlan child interface for VRRP in a VRF configuration, allowing the interface creator to specify directly what master interface should be inherited by the child, without having to deal with asynchronous complications and potential race conditions. Signed-off-by: Theuns Verwoerd <theuns.verwoerd@alliedtelesis.co.nz> Acked-by: David Ahern <dsa@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/core/rtnetlink.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 152744643074..adfb54b896da 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -2570,7 +2570,7 @@ replay:
2570 return -ENODEV; 2570 return -ENODEV;
2571 } 2571 }
2572 2572
2573 if (tb[IFLA_MAP] || tb[IFLA_MASTER] || tb[IFLA_PROTINFO]) 2573 if (tb[IFLA_MAP] || tb[IFLA_PROTINFO])
2574 return -EOPNOTSUPP; 2574 return -EOPNOTSUPP;
2575 2575
2576 if (!ops) { 2576 if (!ops) {
@@ -2652,6 +2652,11 @@ replay:
2652 if (err < 0) 2652 if (err < 0)
2653 goto out_unregister; 2653 goto out_unregister;
2654 } 2654 }
2655 if (tb[IFLA_MASTER]) {
2656 err = do_set_master(dev, nla_get_u32(tb[IFLA_MASTER]));
2657 if (err)
2658 goto out_unregister;
2659 }
2655out: 2660out:
2656 if (link_net) 2661 if (link_net)
2657 put_net(link_net); 2662 put_net(link_net);