iplink: Kill redundant network device name checks

Since commit 625df645b7 (Check user supplied interface name lengths)
iplink_parse() validates network device name using check_ifname()
helpers.

Remove redundant "name" length checks from iplink_parse() callers.

Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
Serhey Popovych 2017-12-18 20:54:08 +02:00 committed by Stephen Hemminger
parent f88becf35e
commit dac9ff35ea
2 changed files with 6 additions and 10 deletions

View File

@ -38,7 +38,7 @@ static int vxcan_parse_opt(struct link_util *lu, int argc, char **argv,
char *link = NULL;
char *type = NULL;
int index = 0;
int err, len;
int err;
struct rtattr *data;
int group;
struct ifinfomsg *ifm, *peer_ifm;
@ -66,10 +66,8 @@ static int vxcan_parse_opt(struct link_util *lu, int argc, char **argv,
return err;
if (name) {
len = strlen(name) + 1;
if (len > IFNAMSIZ)
invarg("\"name\" too long\n", *argv);
addattr_l(hdr, 1024, IFLA_IFNAME, name, len);
addattr_l(hdr, 1024,
IFLA_IFNAME, name, strlen(name) + 1);
}
peer_ifm = RTA_DATA(data);

View File

@ -36,7 +36,7 @@ static int veth_parse_opt(struct link_util *lu, int argc, char **argv,
char *link = NULL;
char *type = NULL;
int index = 0;
int err, len;
int err;
struct rtattr *data;
int group;
struct ifinfomsg *ifm, *peer_ifm;
@ -64,10 +64,8 @@ static int veth_parse_opt(struct link_util *lu, int argc, char **argv,
return err;
if (name) {
len = strlen(name) + 1;
if (len > IFNAMSIZ)
invarg("\"name\" too long\n", *argv);
addattr_l(hdr, 1024, IFLA_IFNAME, name, len);
addattr_l(hdr, 1024,
IFLA_IFNAME, name, strlen(name) + 1);
}
peer_ifm = RTA_DATA(data);