Skip to contentSkip to conversation

batctl: tcpdump: Add support for MCASTv2 RTR(4|6) flags

PATCH New Sven Eckelmann 1 participant 2 messages Jun 29, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 batctl: tcpdump: Add support for MCASTv2 RTR(4|6) flags

The batman-adv commit 0a7733468f95 ("batman-adv: mcast: detect, distribute and maintain multicast router presence") added support for two new flags BATADV_MCAST_WANT_NO_RTR4 and BATADV_MCAST_WANT_NO_RTR6. These are announced in IV_OGM and OGMv2.

batctl's tcpdump requires support for it to make debugging of router-to-router multicast problems in networks easier.

---
 tcpdump.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
tcpdump.c +4 -2
index 158b82e..0e2ae8e 100644
@@ -230,10 +230,12 @@ static void batctl_tvlv_parse_mcast_v2(void *buff, ssize_t buff_len)
 
 	flags = tvlv->flags;
 
-	printf("\tTVLV MCASTv2: [%c%c%c]\n",
+	printf("\tTVLV MCASTv2: [%c%c%c%s%s]\n",
 	       flags & BATADV_MCAST_WANT_ALL_UNSNOOPABLES ? 'U' : '.',
 	       flags & BATADV_MCAST_WANT_ALL_IPV4 ? '4' : '.',
-	       flags & BATADV_MCAST_WANT_ALL_IPV6 ? '6' : '.');
+	       flags & BATADV_MCAST_WANT_ALL_IPV6 ? '6' : '.',
+	       !(flags & BATADV_MCAST_WANT_NO_RTR4) ? "R4" : ". ",
+	       !(flags & BATADV_MCAST_WANT_NO_RTR6) ? "R6" : ". ");
 }
 
 typedef void (*batctl_tvlv_parser_t)(void *buff, ssize_t buff_len);
Signature · 1 line
2.20.1
#1 lore raw

PATCH 2/2 batctl: mcast_flags: Add support for MCASTv2 RTR(4|6) flags

The batman-adv commit 0a7733468f95 ("batman-adv: mcast: detect, distribute and maintain multicast router presence") added support for two new flags BATADV_MCAST_WANT_NO_RTR4 and BATADV_MCAST_WANT_NO_RTR6. These are announced in IV_OGM and OGMv2.

The mcast_flags debug table requires support for it to make debugging of router-to-router multicast problems in networks easier.

---
 mcast_flags.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
mcast_flags.c +7 -3
index a1fdf31..6af544b 100644
@@ -80,10 +80,12 @@ static int mcast_flags_callback(struct nl_msg *msg, void *arg)
 	if (attrs[BATADV_ATTR_MCAST_FLAGS]) {
 		flags = nla_get_u32(attrs[BATADV_ATTR_MCAST_FLAGS]);
 
-		printf("[%c%c%c]\n",
+		printf("[%c%c%c%s%s]\n",
 		       flags & BATADV_MCAST_WANT_ALL_UNSNOOPABLES ? 'U' : '.',
 		       flags & BATADV_MCAST_WANT_ALL_IPV4 ? '4' : '.',
-		       flags & BATADV_MCAST_WANT_ALL_IPV6 ? '6' : '.');
+		       flags & BATADV_MCAST_WANT_ALL_IPV6 ? '6' : '.',
+		       !(flags & BATADV_MCAST_WANT_NO_RTR4) ? "R4" : ". ",
+		       !(flags & BATADV_MCAST_WANT_NO_RTR6) ? "R6" : ". ");
 	} else {
 		printf("-\n");
 	}
@@ -124,7 +126,7 @@ static int netlink_print_mcast_flags(struct state *state, char *orig_iface,
         }
 
 	ret = asprintf(&header,
-		"Multicast flags (own flags: [%c%c%c])\n"
+		"Multicast flags (own flags: [%c%c%c%s%s])\n"
 		 "* Bridged [U]\t\t\t\t%c\n"
 		 "* No IGMP/MLD Querier [4/6]:\t\t%c/%c\n"
 		 "* Shadowing IGMP/MLD Querier [4/6]:\t%c/%c\n"
@@ -133,6 +135,8 @@ static int netlink_print_mcast_flags(struct state *state, char *orig_iface,
 		 (mcast_flags & BATADV_MCAST_WANT_ALL_UNSNOOPABLES) ? 'U' : '.',
 		 (mcast_flags & BATADV_MCAST_WANT_ALL_IPV4) ? '4' : '.',
 		 (mcast_flags & BATADV_MCAST_WANT_ALL_IPV6) ? '6' : '.',
+	         !(mcast_flags & BATADV_MCAST_WANT_NO_RTR4) ? "R4" : ". ",
+	         !(mcast_flags & BATADV_MCAST_WANT_NO_RTR6) ? "R6" : ". ",
 		 bridged ? 'U' : '.',
 		 querier4, querier6, shadowing4, shadowing6,
 		 "Originator", "Flags");
Signature · 1 line
2.20.1