* [PATCH] rtnetlink: Handle IFLA_MASTER parameter when processing rtnl_newlink
@ 2017-01-30 22:28 Theuns Verwoerd
2017-01-30 22:44 ` Stephen Hemminger
0 siblings, 1 reply; 9+ messages in thread
From: Theuns Verwoerd @ 2017-01-30 22:28 UTC (permalink / raw)
To: netdev@vger.kernel.org; +Cc: David Ahern
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);
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] rtnetlink: Handle IFLA_MASTER parameter when processing rtnl_newlink
2017-01-30 22:28 Theuns Verwoerd
@ 2017-01-30 22:44 ` Stephen Hemminger
0 siblings, 0 replies; 9+ messages in thread
From: Stephen Hemminger @ 2017-01-30 22:44 UTC (permalink / raw)
To: Theuns Verwoerd; +Cc: netdev@vger.kernel.org, David Ahern
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.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH] rtnetlink: Handle IFLA_MASTER parameter when processing rtnl_newlink
@ 2017-01-30 23:23 Theuns Verwoerd
2017-01-30 23:57 ` Stephen Hemminger
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Theuns Verwoerd @ 2017-01-30 23:23 UTC (permalink / raw)
To: netdev; +Cc: dsa, Theuns Verwoerd
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>
---
net/core/rtnetlink.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
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);
--
2.11.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] rtnetlink: Handle IFLA_MASTER parameter when processing rtnl_newlink
2017-01-30 23:23 [PATCH] rtnetlink: Handle IFLA_MASTER parameter when processing rtnl_newlink Theuns Verwoerd
@ 2017-01-30 23:57 ` Stephen Hemminger
2017-01-31 6:49 ` Cong Wang
` (2 subsequent siblings)
3 siblings, 0 replies; 9+ messages in thread
From: Stephen Hemminger @ 2017-01-30 23:57 UTC (permalink / raw)
To: Theuns Verwoerd; +Cc: netdev, dsa
On Tue, 31 Jan 2017 12:23:46 +1300
Theuns Verwoerd <theuns.verwoerd@alliedtelesis.co.nz> wrote:
> 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>
Thanks it came through without modification by email client or server this time.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] rtnetlink: Handle IFLA_MASTER parameter when processing rtnl_newlink
2017-01-30 23:23 [PATCH] rtnetlink: Handle IFLA_MASTER parameter when processing rtnl_newlink 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 21:49 ` David Ahern
2017-02-01 16:53 ` David Miller
3 siblings, 1 reply; 9+ messages in thread
From: Cong Wang @ 2017-01-31 6:49 UTC (permalink / raw)
To: Theuns Verwoerd; +Cc: Linux Kernel Network Developers, David Ahern
On Mon, Jan 30, 2017 at 3:23 PM, Theuns Verwoerd
<theuns.verwoerd@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().
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] rtnetlink: Handle IFLA_MASTER parameter when processing rtnl_newlink
2017-01-31 6:49 ` Cong Wang
@ 2017-01-31 20:25 ` David Ahern
2017-01-31 20:49 ` David Miller
0 siblings, 1 reply; 9+ messages in thread
From: David Ahern @ 2017-01-31 20:25 UTC (permalink / raw)
To: Cong Wang, Theuns Verwoerd; +Cc: Linux Kernel Network Developers
On 1/30/17 11:49 PM, Cong Wang wrote:
> On Mon, Jan 30, 2017 at 3:23 PM, Theuns Verwoerd
> <theuns.verwoerd@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.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] rtnetlink: Handle IFLA_MASTER parameter when processing rtnl_newlink
2017-01-31 20:25 ` David Ahern
@ 2017-01-31 20:49 ` David Miller
0 siblings, 0 replies; 9+ messages in thread
From: David Miller @ 2017-01-31 20:49 UTC (permalink / raw)
To: dsa; +Cc: xiyou.wangcong, theuns.verwoerd, netdev
From: David Ahern <dsa@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.verwoerd@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.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] rtnetlink: Handle IFLA_MASTER parameter when processing rtnl_newlink
2017-01-30 23:23 [PATCH] rtnetlink: Handle IFLA_MASTER parameter when processing rtnl_newlink Theuns Verwoerd
2017-01-30 23:57 ` Stephen Hemminger
2017-01-31 6:49 ` Cong Wang
@ 2017-01-31 21:49 ` David Ahern
2017-02-01 16:53 ` David Miller
3 siblings, 0 replies; 9+ messages in thread
From: David Ahern @ 2017-01-31 21:49 UTC (permalink / raw)
To: Theuns Verwoerd, netdev, roopa
On 1/30/17 4:23 PM, Theuns Verwoerd wrote:
> 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>
> ---
> net/core/rtnetlink.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
I can't see any harm in doing the enslavement in the same command that creates the link and it does simplify VRR setup.
Acked-by: David Ahern <dsa@cumulusnetworks.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] rtnetlink: Handle IFLA_MASTER parameter when processing rtnl_newlink
2017-01-30 23:23 [PATCH] rtnetlink: Handle IFLA_MASTER parameter when processing rtnl_newlink Theuns Verwoerd
` (2 preceding siblings ...)
2017-01-31 21:49 ` David Ahern
@ 2017-02-01 16:53 ` David Miller
3 siblings, 0 replies; 9+ messages in thread
From: David Miller @ 2017-02-01 16:53 UTC (permalink / raw)
To: theuns.verwoerd; +Cc: netdev, dsa
From: Theuns Verwoerd <theuns.verwoerd@alliedtelesis.co.nz>
Date: Tue, 31 Jan 2017 12:23:46 +1300
> 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>
Applied to net-next, thanks.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2017-02-01 16:53 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-30 23:23 [PATCH] rtnetlink: Handle IFLA_MASTER parameter when processing rtnl_newlink 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
-- strict thread matches above, loose matches on Subject: below --
2017-01-30 22:28 Theuns Verwoerd
2017-01-30 22:44 ` Stephen Hemminger
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).