Commit c46a49a4 authored by Taehee Yoo's avatar Taehee Yoo Committed by David S. Miller

bareudp: print error message when command fails

When bareudp netlink command fails, it doesn't print any error message.
So, users couldn't know the exact reason.
In order to tell the exact reason to the user, the extack error message
is used in this patch.
Signed-off-by: default avatarTaehee Yoo <ap420073@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent eea45da4
...@@ -556,10 +556,17 @@ static int bareudp_validate(struct nlattr *tb[], struct nlattr *data[], ...@@ -556,10 +556,17 @@ static int bareudp_validate(struct nlattr *tb[], struct nlattr *data[],
return 0; return 0;
} }
static int bareudp2info(struct nlattr *data[], struct bareudp_conf *conf) static int bareudp2info(struct nlattr *data[], struct bareudp_conf *conf,
struct netlink_ext_ack *extack)
{ {
if (!data[IFLA_BAREUDP_PORT] || !data[IFLA_BAREUDP_ETHERTYPE]) if (!data[IFLA_BAREUDP_PORT]) {
NL_SET_ERR_MSG(extack, "port not specified");
return -EINVAL;
}
if (!data[IFLA_BAREUDP_ETHERTYPE]) {
NL_SET_ERR_MSG(extack, "ethertype not specified");
return -EINVAL; return -EINVAL;
}
if (data[IFLA_BAREUDP_PORT]) if (data[IFLA_BAREUDP_PORT])
conf->port = nla_get_u16(data[IFLA_BAREUDP_PORT]); conf->port = nla_get_u16(data[IFLA_BAREUDP_PORT]);
...@@ -635,7 +642,7 @@ static int bareudp_newlink(struct net *net, struct net_device *dev, ...@@ -635,7 +642,7 @@ static int bareudp_newlink(struct net *net, struct net_device *dev,
struct bareudp_conf conf; struct bareudp_conf conf;
int err; int err;
err = bareudp2info(data, &conf); err = bareudp2info(data, &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