[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201008135024.1515468-7-razor@blackwall.org>
Date: Thu, 8 Oct 2020 16:50:24 +0300
From: Nikolay Aleksandrov <razor@...ckwall.org>
To: netdev@...r.kernel.org
Cc: roopa@...dia.com, dsahern@...il.com,
Nikolay Aleksandrov <nikolay@...dia.com>
Subject: [PATCH iproute2-next 6/6] bridge: mdb: print protocol when available
From: Nikolay Aleksandrov <nikolay@...dia.com>
Print the mdb entry's protocol (i.e. who added it) when it's available if
the user requested to show details (-d). Currently the only possible
values are RTPROT_STATIC (user-space added) or RTPROT_KERNEL
(automatically added by kernel). The value is kernel controlled.
Signed-off-by: Nikolay Aleksandrov <nikolay@...dia.com>
---
bridge/mdb.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/bridge/mdb.c b/bridge/mdb.c
index b3b58a2385ca..4cd7ca762b78 100644
--- a/bridge/mdb.c
+++ b/bridge/mdb.c
@@ -203,6 +203,13 @@ static void print_mdb_entry(FILE *f, int ifindex, const struct br_mdb_entry *e,
}
close_json_array(PRINT_JSON, NULL);
}
+ if (tb[MDBA_MDB_EATTR_RTPROT]) {
+ __u8 rtprot = rta_getattr_u8(tb[MDBA_MDB_EATTR_RTPROT]);
+ SPRINT_BUF(rtb);
+
+ print_string(PRINT_ANY, "protocol", " proto %s ",
+ rtnl_rtprot_n2a(rtprot, rtb, sizeof(rtb)));
+ }
}
open_json_array(PRINT_JSON, "flags");
--
2.25.4
Powered by blists - more mailing lists