netlink: check new interface name is valid or not before sending request

This commit is contained in:
Yu Watanabe 2019-03-04 11:24:33 +09:00
parent bb5e88a226
commit 4d64309955

View file

@ -13,6 +13,9 @@ int rtnl_set_link_name(sd_netlink **rtnl, int ifindex, const char *name) {
assert(ifindex > 0);
assert(name);
if (!ifname_valid(name))
return -EINVAL;
if (!*rtnl) {
r = sd_netlink_open(rtnl);
if (r < 0)