From: David Ahern <d...@cumulusnetworks.com> Date: Tue, 31 Jan 2017 13:25:32 -0700
> On 1/30/17 11:49 PM, Cong Wang wrote: >> On Mon, Jan 30, 2017 at 3:23 PM, Theuns Verwoerd >> <theuns.verwo...@alliedtelesis.co.nz> wrote: >>> @@ -2653,6 +2653,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); >> >> Not sure if it is too late to call do_set_master() after >> dev_change_net_namespace(). >> > > The master device index is relative to a namespace. If both are given then > the namespace change must be done first. Right and this is exactly how do_setlink() handles this.