提交 160ca014 编写于 作者: T Theuns Verwoerd 提交者: David S. Miller

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: NTheuns Verwoerd <theuns.verwoerd@alliedtelesis.co.nz>
Acked-by: NDavid Ahern <dsa@cumulusnetworks.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 04cdf13e
......@@ -2570,7 +2570,7 @@ static int rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh)
return -ENODEV;
}
if (tb[IFLA_MAP] || tb[IFLA_MASTER] || tb[IFLA_PROTINFO])
if (tb[IFLA_MAP] || tb[IFLA_PROTINFO])
return -EOPNOTSUPP;
if (!ops) {
......@@ -2652,6 +2652,11 @@ static int rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh)
if (err < 0)
goto out_unregister;
}
if (tb[IFLA_MASTER]) {
err = do_set_master(dev, nla_get_u32(tb[IFLA_MASTER]));
if (err)
goto out_unregister;
}
out:
if (link_net)
put_net(link_net);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册