Commit b4bffa4c authored by Guillaume Nault's avatar Guillaume Nault Committed by David S. Miller

bareudp: Add extack support to bareudp_configure()

Add missing extacks for common configuration errors.
Signed-off-by: default avatarGuillaume Nault <gnault@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0976b888
...@@ -609,7 +609,8 @@ static struct bareudp_dev *bareudp_find_dev(struct bareudp_net *bn, ...@@ -609,7 +609,8 @@ static struct bareudp_dev *bareudp_find_dev(struct bareudp_net *bn,
} }
static int bareudp_configure(struct net *net, struct net_device *dev, static int bareudp_configure(struct net *net, struct net_device *dev,
struct bareudp_conf *conf) struct bareudp_conf *conf,
struct netlink_ext_ack *extack)
{ {
struct bareudp_net *bn = net_generic(net, bareudp_net_id); struct bareudp_net *bn = net_generic(net, bareudp_net_id);
struct bareudp_dev *t, *bareudp = netdev_priv(dev); struct bareudp_dev *t, *bareudp = netdev_priv(dev);
...@@ -618,13 +619,17 @@ static int bareudp_configure(struct net *net, struct net_device *dev, ...@@ -618,13 +619,17 @@ static int bareudp_configure(struct net *net, struct net_device *dev,
bareudp->net = net; bareudp->net = net;
bareudp->dev = dev; bareudp->dev = dev;
t = bareudp_find_dev(bn, conf); t = bareudp_find_dev(bn, conf);
if (t) if (t) {
NL_SET_ERR_MSG(extack, "Another bareudp device using the same port already exists");
return -EBUSY; return -EBUSY;
}
if (conf->multi_proto_mode && if (conf->multi_proto_mode &&
(conf->ethertype != htons(ETH_P_MPLS_UC) && (conf->ethertype != htons(ETH_P_MPLS_UC) &&
conf->ethertype != htons(ETH_P_IP))) conf->ethertype != htons(ETH_P_IP))) {
NL_SET_ERR_MSG(extack, "Cannot set multiproto mode for this ethertype (only IPv4 and unicast MPLS are supported)");
return -EINVAL; return -EINVAL;
}
bareudp->port = conf->port; bareudp->port = conf->port;
bareudp->ethertype = conf->ethertype; bareudp->ethertype = conf->ethertype;
...@@ -671,7 +676,7 @@ static int bareudp_newlink(struct net *net, struct net_device *dev, ...@@ -671,7 +676,7 @@ static int bareudp_newlink(struct net *net, struct net_device *dev,
if (err) if (err)
return err; return err;
err = bareudp_configure(net, dev, &conf); err = bareudp_configure(net, dev, &conf, extack);
if (err) if (err)
return err; return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment