diff options
-rw-r--r-- | networking/libiproute/iplink.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/networking/libiproute/iplink.c b/networking/libiproute/iplink.c index 883a1f14a..1a1064bdc 100644 --- a/networking/libiproute/iplink.c +++ b/networking/libiproute/iplink.c | |||
@@ -518,11 +518,11 @@ static void vlan_parse_opt(char **argv, struct nlmsghdr *n, unsigned int size) | |||
518 | id = get_u16(*argv, "id"); | 518 | id = get_u16(*argv, "id"); |
519 | addattr_l(n, size, IFLA_VLAN_ID, &id, sizeof(id)); | 519 | addattr_l(n, size, IFLA_VLAN_ID, &id, sizeof(id)); |
520 | } else if (arg == ARG_protocol) { | 520 | } else if (arg == ARG_protocol) { |
521 | arg = index_in_substrings(protocols, *argv); | 521 | arg = index_in_substrings(protocols, str_tolower(*argv)); |
522 | if (arg == PROTO_8021Q) | 522 | if (arg == PROTO_8021Q) |
523 | proto = ETH_P_8021Q; | 523 | proto = htons(ETH_P_8021Q); |
524 | else if (arg == PROTO_8021AD) | 524 | else if (arg == PROTO_8021AD) |
525 | proto = ETH_P_8021AD; | 525 | proto = htons(ETH_P_8021AD); |
526 | else | 526 | else |
527 | bb_error_msg_and_die("unknown VLAN encapsulation protocol '%s'", | 527 | bb_error_msg_and_die("unknown VLAN encapsulation protocol '%s'", |
528 | *argv); | 528 | *argv); |
@@ -673,13 +673,19 @@ static int do_add_or_delete(char **argv, const unsigned rtm) | |||
673 | 673 | ||
674 | linkinfo->rta_len = (void *)NLMSG_TAIL(&req.n) - (void *)linkinfo; | 674 | linkinfo->rta_len = (void *)NLMSG_TAIL(&req.n) - (void *)linkinfo; |
675 | } | 675 | } |
676 | /* Allow "ip link add dev" and "ip link add name" */ | ||
677 | if (!name_str) | ||
678 | name_str = dev_str; | ||
679 | else if (!dev_str) | ||
680 | dev_str = name_str; | ||
681 | /* else if (!strcmp(name_str, dev_str)) | ||
682 | name_str = dev_str; */ | ||
683 | |||
676 | if (rtm != RTM_NEWLINK) { | 684 | if (rtm != RTM_NEWLINK) { |
677 | if (!dev_str) | 685 | if (!dev_str) |
678 | return 1; /* Need a device to delete */ | 686 | return 1; /* Need a device to delete */ |
679 | req.i.ifi_index = xll_name_to_index(dev_str); | 687 | req.i.ifi_index = xll_name_to_index(dev_str); |
680 | } else { | 688 | } else { |
681 | if (!name_str) | ||
682 | name_str = dev_str; | ||
683 | if (link_str) { | 689 | if (link_str) { |
684 | int idx = xll_name_to_index(link_str); | 690 | int idx = xll_name_to_index(link_str); |
685 | addattr_l(&req.n, sizeof(req), IFLA_LINK, &idx, 4); | 691 | addattr_l(&req.n, sizeof(req), IFLA_LINK, &idx, 4); |