All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Gospodarek <gospo@cumulusnetworks.com>
To: netdev@vger.kernel.org
Cc: sfeldma@gmail.com, jpirko@resnulli.us
Subject: [PATCH iproute2 1/3] ip-link: display parentid for netdevs
Date: Fri,  5 Dec 2014 13:02:15 -0500	[thread overview]
Message-ID: <1417802537-20020-1-git-send-email-gospo@cumulusnetworks.com> (raw)

Display parentid for netdev that may actually be associated with device
capable of offloading network forwarding.  Useful to identify which
netdevs are connected device when multiple forwarding elements are on a
system.

Based on patch from Jiri Pirko but with a different name for netlink
attribute.

Signed-off-by: Andy Gospodarek <gospo@cumulusnetworks.com>
---

I did not include definition for IFLA_PHYS_PARENT_ID as Stephen
indicated that patching if_link.h isn't needed since it will get pulled
later.

 ip/ipaddress.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index 4d99324..d155085 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -581,6 +581,14 @@ int print_linkinfo(const struct sockaddr_nl *who,
 		fprintf(fp, "master %s ", ll_idx_n2a(*(int*)RTA_DATA(tb[IFLA_MASTER]), b1));
 	}
 
+	if (tb[IFLA_PHYS_PARENT_ID]) {
+		SPRINT_BUF(b1);
+		fprintf(fp, "parentid %s ",
+			hexstring_n2a(RTA_DATA(tb[IFLA_PHYS_PARENT_ID]),
+				      RTA_PAYLOAD(tb[IFLA_PHYS_PARENT_ID]),
+				      b1, sizeof(b1)));
+	}
+
 	if (tb[IFLA_PHYS_PORT_ID]) {
 		SPRINT_BUF(b1);
 		fprintf(fp, "portid %s ",
-- 
1.9.3

             reply	other threads:[~2014-12-05 18:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-05 18:02 Andy Gospodarek [this message]
2014-12-05 18:02 ` [PATCH net-next 2/3] netlink: IFLA_PHYS_SWITCH_ID to IFLA_PHYS_PARENT_ID Andy Gospodarek
2014-12-08 15:17   ` Jiri Pirko
2014-12-08 15:37     ` Andy Gospodarek
2014-12-08 16:41       ` Jiri Pirko
2014-12-08 17:49         ` Andy Gospodarek
2014-12-05 18:02 ` [PATCH net-next 3/3] net: rename *_switch_parent_id_get to *_parent_id_get Andy Gospodarek

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=1417802537-20020-1-git-send-email-gospo@cumulusnetworks.com \
    --to=gospo@cumulusnetworks.com \
    --cc=jpirko@resnulli.us \
    --cc=netdev@vger.kernel.org \
    --cc=sfeldma@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.