aboutsummaryrefslogtreecommitdiffstats
path: root/bridge
diff options
context:
space:
mode:
authorRoopa Prabhu <roopa@cumulusnetworks.com>2014-06-07 22:23:42 -0700
committerStephen Hemminger <stephen@networkplumber.org>2014-06-09 12:56:23 -0700
commitcc273a51d0e3e006780ad5abab3c7261b516854c (patch)
tree2c89e8ecefbd7fc27c78c9c443eef360a13fff66 /bridge
parentf89a2a05ffa94ac5bec9f50751f761215356092b (diff)
downloadandroid_external_iproute2-cc273a51d0e3e006780ad5abab3c7261b516854c.tar.gz
android_external_iproute2-cc273a51d0e3e006780ad5abab3c7261b516854c.tar.bz2
android_external_iproute2-cc273a51d0e3e006780ad5abab3c7261b516854c.zip
bridge: Add master device name to bridge fdb show
This patch adds master dev name from NDA_MASTER netlink attribute to bridge fdb show output current iproute2 tries to print 'master' in the output if NTF_MASTER is present. But, kernel today does not set NTF_MASTER during dump requests. Which means I have not seen iproute2 bridge cmd print 'master' atall. This patch overrides the NTF_MASTER flag if NDA_MASTER attribute is present. Example output: before this patch: # bridge fdb show 44:38:39:00:27:ba dev bond2.2003 permanent 44:38:39:00:27:bb dev bond4.2003 permanent 44:38:39:00:27:bc dev bond2.2004 permanent After this patch: # bridge fdb show 44:38:39:00:27:ba dev bond2.2003 master br-2003 permanent 44:38:39:00:27:bb dev bond4.2003 master br-2003 permanent 44:38:39:00:27:bc dev bond2.2004 master br-2004 permanent For comparision with the above, below is the output for NTF_SELF today, # bridge fdb show 33:33:00:00:00:01 dev eth0 self permanent 01:00:5e:00:00:01 dev eth0 self permanent 33:33:ff:00:01:cc dev eth0 self permanent If change in output is a concern, 'master' can be put at the end of the fdb output line or made optional with -d[etails] option. change from v1 to v2: use 'bridge' instead of 'master' in fdb show output change from v2 to v3: use 'master' instead of 'bridge' in fdb show output (master could also be a vxlan device) Signed-off-by: Wilson Kok <wkok@cumulusnetworks.com> Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Diffstat (limited to 'bridge')
-rw-r--r--bridge/fdb.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/bridge/fdb.c b/bridge/fdb.c
index cca99ef..9a07a32 100644
--- a/bridge/fdb.c
+++ b/bridge/fdb.c
@@ -147,7 +147,10 @@ int print_fdb(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
}
if (r->ndm_flags & NTF_SELF)
fprintf(fp, "self ");
- if (r->ndm_flags & NTF_MASTER)
+ if (tb[NDA_MASTER])
+ fprintf(fp, "master %s ",
+ ll_index_to_name(rta_getattr_u32(tb[NDA_MASTER])));
+ else if (r->ndm_flags & NTF_MASTER)
fprintf(fp, "master ");
if (r->ndm_flags & NTF_ROUTER)
fprintf(fp, "router ");