diff options
Diffstat (limited to 'networking/libiproute/iplink.c')
-rw-r--r-- | networking/libiproute/iplink.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/networking/libiproute/iplink.c b/networking/libiproute/iplink.c index f38fba055..312283318 100644 --- a/networking/libiproute/iplink.c +++ b/networking/libiproute/iplink.c | |||
@@ -525,6 +525,24 @@ static void vlan_parse_opt(char **argv, struct nlmsghdr *n, unsigned int size) | |||
525 | addattr_l(n, size, IFLA_VLAN_FLAGS, &flags, sizeof(flags)); | 525 | addattr_l(n, size, IFLA_VLAN_FLAGS, &flags, sizeof(flags)); |
526 | } | 526 | } |
527 | 527 | ||
528 | static void vrf_parse_opt(char **argv, struct nlmsghdr *n, unsigned int size) | ||
529 | { | ||
530 | /* IFLA_VRF_TABLE is an enum, not a define - | ||
531 | * can't test "defined(IFLA_VRF_TABLE)". | ||
532 | */ | ||
533 | #if !defined(IFLA_VRF_MAX) | ||
534 | # define IFLA_VRF_TABLE 1 | ||
535 | #endif | ||
536 | uint32_t table; | ||
537 | |||
538 | if (strcmp(*argv, "table") != 0) | ||
539 | invarg_1_to_2(*argv, "type vrf"); | ||
540 | |||
541 | NEXT_ARG(); | ||
542 | table = get_u32(*argv, "table"); | ||
543 | addattr_l(n, size, IFLA_VRF_TABLE, &table, sizeof(table)); | ||
544 | } | ||
545 | |||
528 | #ifndef NLMSG_TAIL | 546 | #ifndef NLMSG_TAIL |
529 | #define NLMSG_TAIL(nmsg) \ | 547 | #define NLMSG_TAIL(nmsg) \ |
530 | ((struct rtattr *) (((void *) (nmsg)) + NLMSG_ALIGN((nmsg)->nlmsg_len))) | 548 | ((struct rtattr *) (((void *) (nmsg)) + NLMSG_ALIGN((nmsg)->nlmsg_len))) |
@@ -563,6 +581,8 @@ static int do_add_or_delete(char **argv, const unsigned rtm) | |||
563 | if (rtm == RTM_NEWLINK) | 581 | if (rtm == RTM_NEWLINK) |
564 | req.n.nlmsg_flags |= NLM_F_CREATE|NLM_F_EXCL; | 582 | req.n.nlmsg_flags |= NLM_F_CREATE|NLM_F_EXCL; |
565 | 583 | ||
584 | /* NB: update iplink_full_usage if you extend this code */ | ||
585 | |||
566 | while (*argv) { | 586 | while (*argv) { |
567 | arg = index_in_substrings(keywords, *argv); | 587 | arg = index_in_substrings(keywords, *argv); |
568 | if (arg == ARG_type) { | 588 | if (arg == ARG_type) { |
@@ -582,7 +602,7 @@ static int do_add_or_delete(char **argv, const unsigned rtm) | |||
582 | } else if (arg == ARG_address) { | 602 | } else if (arg == ARG_address) { |
583 | NEXT_ARG(); | 603 | NEXT_ARG(); |
584 | address_str = *argv; | 604 | address_str = *argv; |
585 | dbg("address_str:'%s'", name_str); | 605 | dbg("address_str:'%s'", address_str); |
586 | } else { | 606 | } else { |
587 | if (arg == ARG_dev) { | 607 | if (arg == ARG_dev) { |
588 | if (dev_str) | 608 | if (dev_str) |
@@ -609,6 +629,8 @@ static int do_add_or_delete(char **argv, const unsigned rtm) | |||
609 | 629 | ||
610 | if (strcmp(type_str, "vlan") == 0) | 630 | if (strcmp(type_str, "vlan") == 0) |
611 | vlan_parse_opt(argv, &req.n, sizeof(req)); | 631 | vlan_parse_opt(argv, &req.n, sizeof(req)); |
632 | else if (strcmp(type_str, "vrf") == 0) | ||
633 | vrf_parse_opt(argv, &req.n, sizeof(req)); | ||
612 | 634 | ||
613 | data->rta_len = (void *)NLMSG_TAIL(&req.n) - (void *)data; | 635 | data->rta_len = (void *)NLMSG_TAIL(&req.n) - (void *)data; |
614 | } | 636 | } |