Merge branch 'iproute2-master' into iproute2-next

Signed-off-by: David Ahern <dsahern@gmail.com>
This commit is contained in:
David Ahern 2018-01-24 09:59:03 -08:00
commit 6517b5c0ac
15 changed files with 43 additions and 43 deletions

View File

@ -374,7 +374,7 @@ static int fdb_show(int argc, char **argv)
/*we'll keep around filter_dev for older kernels */
if (filter_dev) {
filter_index = if_nametoindex(filter_dev);
filter_index = ll_name_to_index(filter_dev);
if (filter_index == 0) {
fprintf(stderr, "Cannot find device \"%s\"\n",
filter_dev);
@ -463,7 +463,7 @@ static int fdb_modify(int cmd, int flags, int argc, char **argv)
invarg("invalid VNI\n", *argv);
} else if (strcmp(*argv, "via") == 0) {
NEXT_ARG();
via = if_nametoindex(*argv);
via = ll_name_to_index(*argv);
if (via == 0)
invarg("invalid device\n", *argv);
} else if (strcmp(*argv, "self") == 0) {

View File

@ -311,7 +311,7 @@ static int mdb_show(int argc, char **argv)
}
if (filter_dev) {
filter_index = if_nametoindex(filter_dev);
filter_index = ll_name_to_index(filter_dev);
if (filter_index == 0) {
fprintf(stderr, "Cannot find device \"%s\"\n",
filter_dev);

View File

@ -567,7 +567,7 @@ static int vlan_show(int argc, char **argv)
}
if (filter_dev) {
filter_index = if_nametoindex(filter_dev);
filter_index = ll_name_to_index(filter_dev);
if (filter_index == 0) {
fprintf(stderr, "Cannot find device \"%s\"\n",
filter_dev);

View File

@ -177,7 +177,7 @@ static int bond_parse_opt(struct link_util *lu, int argc, char **argv,
addattr8(n, 1024, IFLA_BOND_MODE, mode);
} else if (matches(*argv, "active_slave") == 0) {
NEXT_ARG();
ifindex = if_nametoindex(*argv);
ifindex = ll_name_to_index(*argv);
if (!ifindex)
return -1;
addattr32(n, 1024, IFLA_BOND_ACTIVE_SLAVE, ifindex);
@ -240,7 +240,7 @@ static int bond_parse_opt(struct link_util *lu, int argc, char **argv,
addattr32(n, 1024, IFLA_BOND_ARP_ALL_TARGETS, arp_all_targets);
} else if (matches(*argv, "primary") == 0) {
NEXT_ARG();
ifindex = if_nametoindex(*argv);
ifindex = ll_name_to_index(*argv);
if (!ifindex)
return -1;
addattr32(n, 1024, IFLA_BOND_PRIMARY, ifindex);

View File

@ -792,7 +792,7 @@ int bridge_parse_xstats(struct link_util *lu, int argc, char **argv)
xstats_print_attr = BRIDGE_XSTATS_MCAST;
} else if (strcmp(*argv, "dev") == 0) {
NEXT_ARG();
filter_index = if_nametoindex(*argv);
filter_index = ll_name_to_index(*argv);
if (filter_index == 0) {
fprintf(stderr, "Cannot find device \"%s\"\n",
*argv);

View File

@ -131,7 +131,7 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
NEXT_ARG();
check_duparg(&attrs, IFLA_VXLAN_LINK, "dev", *argv);
link = if_nametoindex(*argv);
link = ll_name_to_index(*argv);
if (link == 0) {
fprintf(stderr, "Cannot find device \"%s\"\n",
*argv);

View File

@ -559,7 +559,7 @@ static int parse_encap_seg6local(struct rtattr *rta, size_t len, int *argcp,
NEXT_ARG();
if (iif_ok++)
duparg2("iif", *argv);
iif = if_nametoindex(*argv);
iif = ll_name_to_index(*argv);
if (!iif)
invarg("\"iif\" interface not found\n", *argv);
rta_addattr32(rta, len, SEG6_LOCAL_IIF, iif);
@ -567,7 +567,7 @@ static int parse_encap_seg6local(struct rtattr *rta, size_t len, int *argcp,
NEXT_ARG();
if (oif_ok++)
duparg2("oif", *argv);
oif = if_nametoindex(*argv);
oif = ll_name_to_index(*argv);
if (!oif)
invarg("\"oif\" interface not found\n", *argv);
rta_addattr32(rta, len, SEG6_LOCAL_OIF, oif);

View File

@ -238,23 +238,19 @@ get_failed:
saddr = get_addr32(*argv);
} else if (!matches(*argv, "dev")) {
NEXT_ARG();
link = if_nametoindex(*argv);
link = ll_name_to_index(*argv);
if (link == 0) {
fprintf(stderr, "Cannot find device \"%s\"\n",
*argv);
exit(-1);
}
} else if (!matches(*argv, "ttl") ||
!matches(*argv, "hoplimit")) {
unsigned int uval;
!matches(*argv, "hoplimit") ||
!matches(*argv, "hlim")) {
NEXT_ARG();
if (strcmp(*argv, "inherit") != 0) {
if (get_unsigned(&uval, *argv, 0))
if (get_u8(&ttl, *argv, 0))
invarg("invalid TTL\n", *argv);
if (uval > 255)
invarg("TTL must be <= 255\n", *argv);
ttl = uval;
} else
ttl = 0;
} else if (!matches(*argv, "tos") ||

View File

@ -251,20 +251,21 @@ get_failed:
memcpy(&laddr, &addr.data, sizeof(laddr));
} else if (!matches(*argv, "dev")) {
NEXT_ARG();
link = if_nametoindex(*argv);
link = ll_name_to_index(*argv);
if (link == 0) {
fprintf(stderr, "Cannot find device \"%s\"\n",
*argv);
exit(-1);
}
} else if (!matches(*argv, "ttl") ||
!matches(*argv, "hoplimit")) {
__u8 uval;
!matches(*argv, "hoplimit") ||
!matches(*argv, "hlim")) {
NEXT_ARG();
if (get_u8(&uval, *argv, 0))
invarg("invalid TTL", *argv);
hop_limit = uval;
if (strcmp(*argv, "inherit") != 0) {
if (get_u8(&hop_limit, *argv, 0))
invarg("invalid HLIM\n", *argv);
} else
hop_limit = 0;
} else if (!matches(*argv, "tos") ||
!matches(*argv, "tclass") ||
!matches(*argv, "dsfield")) {

View File

@ -193,18 +193,18 @@ get_failed:
memcpy(&laddr, addr.data, sizeof(laddr));
} else if (matches(*argv, "dev") == 0) {
NEXT_ARG();
link = if_nametoindex(*argv);
link = ll_name_to_index(*argv);
if (link == 0)
invarg("\"dev\" is invalid", *argv);
} else if (strcmp(*argv, "hoplimit") == 0 ||
strcmp(*argv, "ttl") == 0 ||
} else if (strcmp(*argv, "ttl") == 0 ||
strcmp(*argv, "hoplimit") == 0 ||
strcmp(*argv, "hlim") == 0) {
__u8 uval;
NEXT_ARG();
if (get_u8(&uval, *argv, 0))
invarg("invalid HLIM", *argv);
hop_limit = uval;
if (strcmp(*argv, "inherit") != 0) {
if (get_u8(&hop_limit, *argv, 0))
invarg("invalid HLIM\n", *argv);
} else
hop_limit = 0;
} else if (strcmp(*argv, "encaplimit") == 0) {
NEXT_ARG();
if (strcmp(*argv, "none") == 0) {

View File

@ -200,11 +200,12 @@ get_failed:
laddr = get_addr32(*argv);
} else if (matches(*argv, "dev") == 0) {
NEXT_ARG();
link = if_nametoindex(*argv);
link = ll_name_to_index(*argv);
if (link == 0)
invarg("\"dev\" is invalid", *argv);
} else if (strcmp(*argv, "ttl") == 0 ||
strcmp(*argv, "hoplimit") == 0) {
strcmp(*argv, "hoplimit") == 0 ||
strcmp(*argv, "hlim") == 0) {
NEXT_ARG();
if (strcmp(*argv, "inherit") != 0) {
if (get_u8(&ttl, *argv, 0))

View File

@ -69,7 +69,7 @@ static int vti_parse_opt(struct link_util *lu, int argc, char **argv,
unsigned int saddr = 0;
unsigned int daddr = 0;
unsigned int link = 0;
unsigned int fwmark = 0;
__u32 fwmark = 0;
int len;
if (!(n->nlmsg_flags & NLM_F_CREATE)) {
@ -137,7 +137,7 @@ get_failed:
saddr = get_addr32(*argv);
} else if (!matches(*argv, "dev")) {
NEXT_ARG();
link = if_nametoindex(*argv);
link = ll_name_to_index(*argv);
if (link == 0) {
fprintf(stderr, "Cannot find device \"%s\"\n",
*argv);

View File

@ -143,9 +143,12 @@ get_failed:
memcpy(&saddr, addr.data, sizeof(saddr));
} else if (!matches(*argv, "dev")) {
NEXT_ARG();
link = if_nametoindex(*argv);
if (link == 0)
link = ll_name_to_index(*argv);
if (link == 0) {
fprintf(stderr, "Cannot find device \"%s\"\n",
*argv);
exit(-1);
}
} else if (strcmp(*argv, "fwmark") == 0) {
NEXT_ARG();
if (get_u32(&fwmark, *argv, 0))
@ -157,7 +160,6 @@ get_failed:
addattr32(n, 1024, IFLA_VTI_IKEY, ikey);
addattr32(n, 1024, IFLA_VTI_OKEY, okey);
addattr_l(n, 1024, IFLA_VTI_LOCAL, &saddr, sizeof(saddr));
addattr_l(n, 1024, IFLA_VTI_REMOTE, &daddr, sizeof(daddr));
addattr32(n, 1024, IFLA_VTI_FWMARK, fwmark);

View File

@ -201,11 +201,11 @@ static const char *tnl_encap_str(const char *name, int enabled, int port)
const char *val;
if (!port) {
val = "auto";
val = "auto ";
} else if (port < 0) {
val = "";
} else {
snprintf(b1, sizeof(b1), "%u", port - 1);
snprintf(b1, sizeof(b1), "%u ", port - 1);
val = b1;
}

View File

@ -137,7 +137,7 @@
")" {
return yylval.i = *yytext;
}
[^ \t\r\n()]+ {
[^" \t\r\n()][^ \t\r\n()]* {
yylval.b = bstr_alloc(yytext);
if (yylval.b == NULL)
return ERROR;