From patchwork Fri Dec 5 18:02:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Gospodarek X-Patchwork-Id: 418262 X-Patchwork-Delegate: shemminger@vyatta.com Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 7F76014011B for ; Sat, 6 Dec 2014 05:02:42 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751947AbaLESCe (ORCPT ); Fri, 5 Dec 2014 13:02:34 -0500 Received: from ext3.cumulusnetworks.com ([198.211.106.187]:48577 "EHLO ext3.cumulusnetworks.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751568AbaLESCe (ORCPT ); Fri, 5 Dec 2014 13:02:34 -0500 Received: from localhost (localhost [127.0.0.1]) by ext3.cumulusnetworks.com (Postfix) with ESMTP id 1BB281A662D2; Fri, 5 Dec 2014 10:02:28 -0800 (PST) Received: from ext3.cumulusnetworks.com ([127.0.0.1]) by localhost (ext3.cumulusnetworks.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id zfyxx_LqZcLd; Fri, 5 Dec 2014 10:02:27 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by ext3.cumulusnetworks.com (Postfix) with ESMTP id 826D21A662DF; Fri, 5 Dec 2014 10:02:27 -0800 (PST) X-Virus-Scanned: amavisd-new at cumulusnetworks.com Received: from ext3.cumulusnetworks.com ([127.0.0.1]) by localhost (ext3.cumulusnetworks.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 1-GxYQkqEaJD; Fri, 5 Dec 2014 10:02:27 -0800 (PST) Received: from fedora-devel.home.greyhouse.net (cpe-024-211-243-155.nc.res.rr.com [24.211.243.155]) by ext3.cumulusnetworks.com (Postfix) with ESMTPSA id 2865C1A662D8; Fri, 5 Dec 2014 10:02:27 -0800 (PST) From: Andy Gospodarek 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 Message-Id: <1417802537-20020-1-git-send-email-gospo@cumulusnetworks.com> X-Mailer: git-send-email 1.9.3 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- 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 ",