netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ahern <dsa@cumulusnetworks.com>
To: netdev@vger.kernel.org
Cc: David Ahern <dsa@cumulusnetworks.com>
Subject: [iproute2 net-next] vrf: Add support for slave_info
Date: Tue,  2 Feb 2016 07:43:46 -0800	[thread overview]
Message-ID: <1454427826-6444-2-git-send-email-dsa@cumulusnetworks.com> (raw)
In-Reply-To: <1454427826-6444-1-git-send-email-dsa@cumulusnetworks.com>

Print VRF slave_info attributes if present.

Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
---
Requires IFLA_VRF_PORT_* from linux/if_link.h

 ip/iplink_vrf.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/ip/iplink_vrf.c b/ip/iplink_vrf.c
index 9b4b7728cf6f..abc796886a5f 100644
--- a/ip/iplink_vrf.c
+++ b/ip/iplink_vrf.c
@@ -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,
+};
-- 
2.1.4

  reply	other threads:[~2016-02-02 15:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-02 15:43 [PATCH net-next] net: Add support for fill_slave_info to VRF device David Ahern
2016-02-02 15:43 ` David Ahern [this message]
2016-02-18  1:54   ` [iproute2 net-next] vrf: Add support for slave_info Stephen Hemminger
2016-02-07 19:03 ` [PATCH net-next] net: Add support for fill_slave_info to VRF device David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1454427826-6444-2-git-send-email-dsa@cumulusnetworks.com \
    --to=dsa@cumulusnetworks.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).