netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Theuns Verwoerd <Theuns.Verwoerd@alliedtelesis.co.nz>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	David Ahern <dsa@cumulusnetworks.com>
Subject: Re: [PATCH] rtnetlink: Handle IFLA_MASTER parameter when processing rtnl_newlink
Date: Mon, 30 Jan 2017 14:44:54 -0800	[thread overview]
Message-ID: <20170130144454.7ece3a73@xeon-e3> (raw)
In-Reply-To: <38fc316c-a522-a8ca-d029-25fa5335a954@alliedtelesis.co.nz>

On Mon, 30 Jan 2017 22:28:05 +0000
Theuns Verwoerd <Theuns.Verwoerd@alliedtelesis.co.nz> wrote:

> 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>
> 
> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
> index 75e3ea7bda08..a24719c98238 100644
> --- a/net/core/rtnetlink.c
> +++ b/net/core/rtnetlink.c
> @@ -2571,7 +2571,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) {
> @@ -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);

Your mailer is reformatting text which corrupts patches.
Please adjust your client settings, or use a different mail system.

  reply	other threads:[~2017-01-30 22:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-30 22:28 [PATCH] rtnetlink: Handle IFLA_MASTER parameter when processing rtnl_newlink Theuns Verwoerd
2017-01-30 22:44 ` Stephen Hemminger [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-01-30 23:23 Theuns Verwoerd
2017-01-30 23:57 ` Stephen Hemminger
2017-01-31  6:49 ` Cong Wang
2017-01-31 20:25   ` David Ahern
2017-01-31 20:49     ` David Miller
2017-01-31 21:49 ` David Ahern
2017-02-01 16:53 ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170130144454.7ece3a73@xeon-e3 \
    --to=stephen@networkplumber.org \
    --cc=Theuns.Verwoerd@alliedtelesis.co.nz \
    --cc=dsa@cumulusnetworks.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).