naccyde / rpms / iproute

Forked from rpms/iproute 10 months ago
Clone

Blame SOURCES/iproute2-3.10.0-bridge-Add-master-device-name-to-bridge-fdb-show.patch

a4b897
From 52296b5871435812cb2a05bcc3166968e170d783 Mon Sep 17 00:00:00 2001
a4b897
From: Roopa Prabhu <roopa@cumulusnetworks.com>
a4b897
Date: Sat, 7 Jun 2014 22:23:42 -0700
a4b897
Subject: [PATCH] bridge: Add master device name to bridge fdb show
a4b897
a4b897
This patch adds master dev name from NDA_MASTER netlink attribute
a4b897
 to bridge fdb show output
a4b897
a4b897
current iproute2 tries to print 'master' in the output if NTF_MASTER
a4b897
is present. But, kernel today does not set NTF_MASTER during dump
a4b897
requests. Which means I have not seen iproute2 bridge cmd print 'master' atall.
a4b897
This patch overrides the NTF_MASTER flag if NDA_MASTER attribute is present.
a4b897
a4b897
Example output:
a4b897
a4b897
before this patch:
a4b897
# bridge fdb show
a4b897
44:38:39:00:27:ba dev bond2.2003 permanent
a4b897
44:38:39:00:27:bb dev bond4.2003 permanent
a4b897
44:38:39:00:27:bc dev bond2.2004 permanent
a4b897
a4b897
After this patch:
a4b897
# bridge fdb show
a4b897
44:38:39:00:27:ba dev bond2.2003 master br-2003 permanent
a4b897
44:38:39:00:27:bb dev bond4.2003 master br-2003 permanent
a4b897
44:38:39:00:27:bc dev bond2.2004 master br-2004 permanent
a4b897
a4b897
For comparision with the above, below is the output for NTF_SELF today,
a4b897
# bridge fdb show
a4b897
33:33:00:00:00:01 dev eth0 self permanent
a4b897
01:00:5e:00:00:01 dev eth0 self permanent
a4b897
33:33:ff:00:01:cc dev eth0 self permanent
a4b897
a4b897
If change in output is a concern, 'master' can be put at the end of the fdb
a4b897
output line or made optional with -d[etails] option.
a4b897
a4b897
change from v1 to v2:
a4b897
    use 'bridge' instead of 'master' in fdb show output
a4b897
a4b897
change from v2 to v3:
a4b897
    use 'master' instead of 'bridge' in fdb show output
a4b897
    (master could also be a vxlan device)
a4b897
a4b897
Signed-off-by: Wilson Kok <wkok@cumulusnetworks.com>
a4b897
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
a4b897
---
a4b897
 bridge/fdb.c | 5 ++++-
a4b897
 1 file changed, 4 insertions(+), 1 deletion(-)
a4b897
a4b897
diff --git a/bridge/fdb.c b/bridge/fdb.c
a4b897
index f725012..615541e 100644
a4b897
--- a/bridge/fdb.c
a4b897
+++ b/bridge/fdb.c
a4b897
@@ -145,7 +145,10 @@ int print_fdb(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
a4b897
 	}
a4b897
 	if (r->ndm_flags & NTF_SELF)
a4b897
 		fprintf(fp, "self ");
a4b897
-	if (r->ndm_flags & NTF_MASTER)
a4b897
+	if (tb[NDA_MASTER])
a4b897
+		fprintf(fp, "master %s ",
a4b897
+			ll_index_to_name(rta_getattr_u32(tb[NDA_MASTER])));
a4b897
+	else if (r->ndm_flags & NTF_MASTER)
a4b897
 		fprintf(fp, "master ");
a4b897
 	if (r->ndm_flags & NTF_ROUTER)
a4b897
 		fprintf(fp, "router ");
a4b897
-- 
a4b897
1.8.3.1
a4b897