diff mbox series

[iproute2-next,4/6] bridge: mdb: print filter mode when available

Message ID 20201008135024.1515468-5-razor@blackwall.org (mailing list archive)
State Not Applicable
Headers show
Series bridge: mdb: add support for IGMPv3/MLDv2 attributes | expand

Commit Message

Nikolay Aleksandrov Oct. 8, 2020, 1:50 p.m. UTC
From: Nikolay Aleksandrov <nikolay@nvidia.com>

Print the mdb entry's filter mode when it's available if the user
requested to show details (-d). It can be either include or exclude.
Currently it's kernel controlled and can't be changed by user-space.

Signed-off-by: Nikolay Aleksandrov <nikolay@nvidia.com>
---
 bridge/mdb.c | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/bridge/mdb.c b/bridge/mdb.c
index d33bd5d5c7df..c0cb4fd1421e 100644
--- a/bridge/mdb.c
+++ b/bridge/mdb.c
@@ -150,6 +150,13 @@  static void print_mdb_entry(FILE *f, int ifindex, const struct br_mdb_entry *e,
 	print_string(PRINT_ANY, "state", " %s",
 			   (e->state & MDB_PERMANENT) ? "permanent" : "temp");
 
+	if (show_details && tb && tb[MDBA_MDB_EATTR_GROUP_MODE]) {
+		__u8 mode = rta_getattr_u8(tb[MDBA_MDB_EATTR_GROUP_MODE]);
+
+		print_string(PRINT_ANY, "filter_mode", " filter_mode %s",
+			     mode == MCAST_INCLUDE ? "include" : "exclude");
+	}
+
 	open_json_array(PRINT_JSON, "flags");
 	if (e->flags & MDB_FLAGS_OFFLOAD)
 		print_string(PRINT_ANY, NULL, " %s", "offload");