From: David Ahern <dsahern@gmail.com>
To: netdev@vger.kernel.org
Cc: j.vosburgh@gmail.com, vfalico@gmail.com, andy@greyhouse.net,
jiri@mellanox.com, idosch@mellanox.com, davem@davemloft.net,
bridge@lists.linux-foundation.org,
David Ahern <dsahern@gmail.com>
Subject: [PATCH net-next 4/7] net: vrf: Add extack messages for enslave errors
Date: Tue, 3 Oct 2017 21:58:51 -0700 [thread overview]
Message-ID: <1507093134-20406-5-git-send-email-dsahern@gmail.com> (raw)
In-Reply-To: <1507093134-20406-1-git-send-email-dsahern@gmail.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
---
drivers/net/vrf.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
index 77d0655a0250..0b54f553228e 100644
--- a/drivers/net/vrf.c
+++ b/drivers/net/vrf.c
@@ -772,8 +772,11 @@ static int do_vrf_add_slave(struct net_device *dev, struct net_device *port_dev,
/* do not allow loopback device to be enslaved to a VRF.
* The vrf device acts as the loopback for the vrf.
*/
- if (port_dev == dev_net(dev)->loopback_dev)
+ if (port_dev == dev_net(dev)->loopback_dev) {
+ NL_SET_ERR_MSG(extack,
+ "Can not enslave loopback device to a VRF");
return -EOPNOTSUPP;
+ }
port_dev->priv_flags |= IFF_L3MDEV_SLAVE;
ret = netdev_master_upper_dev_link(port_dev, dev, NULL, NULL, extack);
@@ -792,7 +795,13 @@ static int do_vrf_add_slave(struct net_device *dev, struct net_device *port_dev,
static int vrf_add_slave(struct net_device *dev, struct net_device *port_dev,
struct netlink_ext_ack *extack)
{
- if (netif_is_l3_master(port_dev) || netif_is_l3_slave(port_dev))
+ if (netif_is_l3_master(port_dev)) {
+ NL_SET_ERR_MSG(extack,
+ "Can not enslave an L3 master device to a VRF");
+ return -EINVAL;
+ }
+
+ if (netif_is_l3_slave(port_dev))
return -EINVAL;
return do_vrf_add_slave(dev, port_dev, extack);
--
2.1.4
next prev parent reply other threads:[~2017-10-04 4:59 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-04 4:58 [PATCH net-next 0/7] net: Plumb extack error reporting to enslavements David Ahern
2017-10-04 4:58 ` [PATCH net-next 1/7] net: Add extack to netdev_notifier_info David Ahern
2017-10-04 4:58 ` [PATCH net-next 2/7] net: Add extack to ndo_add_slave David Ahern
2017-10-04 4:58 ` [PATCH net-next 3/7] net: Add extack to upper device linking David Ahern
2017-10-04 4:58 ` David Ahern [this message]
2017-10-04 4:58 ` [PATCH net-next 5/7] net: bonding: Add extack messages for some enslave failures David Ahern
2017-10-04 6:38 ` Jiri Pirko
2017-10-04 15:35 ` David Ahern
2017-10-04 18:04 ` Jiri Pirko
2017-10-04 18:06 ` David Ahern
2017-10-04 18:39 ` Jiri Pirko
2017-10-04 4:58 ` [PATCH net-next 6/7] net: bridge: Pass extack to down to netdev_master_upper_dev_link David Ahern
2017-10-04 15:13 ` Stephen Hemminger
2017-10-04 16:16 ` David Ahern
2017-10-04 4:58 ` [PATCH net-next 7/7] mlxsw: spectrum: Add extack messages for enslave failures David Ahern
2017-10-04 13:24 ` Ido Schimmel
2017-10-04 15:44 ` David Ahern
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=1507093134-20406-5-git-send-email-dsahern@gmail.com \
--to=dsahern@gmail.com \
--cc=andy@greyhouse.net \
--cc=bridge@lists.linux-foundation.org \
--cc=davem@davemloft.net \
--cc=idosch@mellanox.com \
--cc=j.vosburgh@gmail.com \
--cc=jiri@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=vfalico@gmail.com \
/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).