]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
vrf: Add support for slave_info
authorDavid Ahern <dsa@cumulusnetworks.com>
Tue, 2 Feb 2016 15:43:46 +0000 (07:43 -0800)
committerStephen Hemminger <stephen@networkplumber.org>
Thu, 18 Feb 2016 01:45:04 +0000 (17:45 -0800)
Print VRF slave_info attributes if present.

Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
ip/iplink_vrf.c

index 9b4b7728cf6f146ccd5ddfc2daca20a68f79a87a..abc796886a5f7607260c32debb102b185193a358 100644 (file)
@@ -64,6 +64,18 @@ static void vrf_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
                fprintf(f, "table %u ", rta_getattr_u32(tb[IFLA_VRF_TABLE]));
 }
 
+static void vrf_slave_print_opt(struct link_util *lu, FILE *f,
+                               struct rtattr *tb[])
+{
+       if (!tb)
+               return;
+
+       if (tb[IFLA_VRF_PORT_TABLE]) {
+               fprintf(f, "table %u ",
+                       rta_getattr_u32(tb[IFLA_VRF_PORT_TABLE]));
+       }
+}
+
 static void vrf_print_help(struct link_util *lu, int argc, char **argv,
                              FILE *f)
 {
@@ -77,3 +89,10 @@ struct link_util vrf_link_util = {
        .print_opt      = vrf_print_opt,
        .print_help     = vrf_print_help,
 };
+
+struct link_util vrf_slave_link_util = {
+        .id             = "vrf",
+        .maxattr        = IFLA_VRF_PORT_MAX,
+       .print_opt      = vrf_slave_print_opt,
+        .slave          = true,
+};