Skip to content

Commit c46a49a

Browse files
TaeheeYoodavem330
authored andcommitted
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: Taehee Yoo <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent eea45da commit c46a49a

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

drivers/net/bareudp.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -556,10 +556,17 @@ static int bareudp_validate(struct nlattr *tb[], struct nlattr *data[],
556556
return 0;
557557
}
558558

559-
static int bareudp2info(struct nlattr *data[], struct bareudp_conf *conf)
559+
static int bareudp2info(struct nlattr *data[], struct bareudp_conf *conf,
560+
struct netlink_ext_ack *extack)
560561
{
561-
if (!data[IFLA_BAREUDP_PORT] || !data[IFLA_BAREUDP_ETHERTYPE])
562+
if (!data[IFLA_BAREUDP_PORT]) {
563+
NL_SET_ERR_MSG(extack, "port not specified");
562564
return -EINVAL;
565+
}
566+
if (!data[IFLA_BAREUDP_ETHERTYPE]) {
567+
NL_SET_ERR_MSG(extack, "ethertype not specified");
568+
return -EINVAL;
569+
}
563570

564571
if (data[IFLA_BAREUDP_PORT])
565572
conf->port = nla_get_u16(data[IFLA_BAREUDP_PORT]);
@@ -635,7 +642,7 @@ static int bareudp_newlink(struct net *net, struct net_device *dev,
635642
struct bareudp_conf conf;
636643
int err;
637644

638-
err = bareudp2info(data, &conf);
645+
err = bareudp2info(data, &conf, extack);
639646
if (err)
640647
return err;
641648

0 commit comments

Comments
 (0)