* [PATCH iproute2-next v5 0/3] bridge: dump mcast querier state per vlan
@ 2025-06-23 9:33 Fabian Pfitzner
2025-06-23 9:33 ` [PATCH iproute2-next v5 1/3] bridge: move mcast querier dumping code into a shared function Fabian Pfitzner
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Fabian Pfitzner @ 2025-06-23 9:33 UTC (permalink / raw)
To: netdev; +Cc: dsahern, idosch, bridge, entwicklung, razor, Fabian Pfitzner
Dump the multicast querier state per vlan.
This commit is almost identical to [1].
The querier state can be seen with:
bridge -d vlan global
The options for vlan filtering and vlan mcast snooping have to be enabled
in order to see the output:
ip link set [dev] type bridge mcast_vlan_snooping 1 vlan_filtering 1
The querier state shows the following information for IPv4 and IPv6
respectively:
1) The ip address of the current querier in the network. This could be
ourselves or an external querier.
2) The port on which the querier was seen
3) Querier timeout in seconds
[1] https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=16aa4494d7fc6543e5e92beb2ce01648b79f8fa2
v1->v2
- refactor code
- link to v1: https://lore.kernel.org/netdev/20250604105322.1185872-1-f.pfitzner@pengutronix.de/
v2->v3
- move code into a shared function
- use shared function in bridge and ip utility
- link to v2: https://lore.kernel.org/netdev/20250611121151.1660231-1-f.pfitzner@pengutronix.de/
v3->v4
- refactor code
- split patch into three patches
- link to v3: https://lore.kernel.org/netdev/20250620121620.2827020-1-f.pfitzner@pengutronix.de/
v4->v5
- run checkpatch
- link to v4: https://lore.kernel.org/netdev/20250623084518.1101527-1-f.pfitzner@pengutronix.de/
Fabian Pfitzner (3):
bridge: move mcast querier dumping code into a shared function
bridge: dump mcast querier per vlan
bridge: refactor bridge mcast querier function
bridge/vlan.c | 5 ++++
include/bridge.h | 3 +++
ip/iplink_bridge.c | 59 +++-------------------------------------------
lib/bridge.c | 57 ++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 68 insertions(+), 56 deletions(-)
--
2.39.5
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH iproute2-next v5 1/3] bridge: move mcast querier dumping code into a shared function
2025-06-23 9:33 [PATCH iproute2-next v5 0/3] bridge: dump mcast querier state per vlan Fabian Pfitzner
@ 2025-06-23 9:33 ` Fabian Pfitzner
2025-06-24 11:55 ` Ido Schimmel
2025-06-24 12:40 ` Nikolay Aleksandrov
2025-06-23 9:33 ` [PATCH iproute2-next v5 2/3] bridge: dump mcast querier per vlan Fabian Pfitzner
2025-06-23 9:33 ` [PATCH iproute2-next v5 3/3] bridge: refactor bridge mcast querier function Fabian Pfitzner
2 siblings, 2 replies; 10+ messages in thread
From: Fabian Pfitzner @ 2025-06-23 9:33 UTC (permalink / raw)
To: netdev; +Cc: dsahern, idosch, bridge, entwicklung, razor, Fabian Pfitzner
Put mcast querier dumping code into a shared function. This function
will be called from the bridge utility in a later patch.
Adapt the code such that the vtb parameter is used
instead of tb[IFLA_BR_MCAST_QUERIER_STATE].
Signed-off-by: Fabian Pfitzner <f.pfitzner@pengutronix.de>
---
I decided to not only move the code into a separate function, but also
to adapt it to fit into the function. If I split it into a pure refactoring
and an adapting commit, the former will not compile preventing git bisects.
---
include/bridge.h | 3 +++
ip/iplink_bridge.c | 59 +++-----------------------------------------
lib/bridge.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 67 insertions(+), 56 deletions(-)
diff --git a/include/bridge.h b/include/bridge.h
index 8bcd1e38..8b0942b5 100644
--- a/include/bridge.h
+++ b/include/bridge.h
@@ -3,9 +3,12 @@
#define __BRIDGE_H__ 1
#include <linux/if_bridge.h>
+#include <linux/rtnetlink.h>
void bridge_print_vlan_flags(__u16 flags);
void bridge_print_vlan_stats_only(const struct bridge_vlan_xstats *vstats);
void bridge_print_vlan_stats(const struct bridge_vlan_xstats *vstats);
+void bridge_print_mcast_querier_state(const struct rtattr *vtb);
+
#endif /* __BRIDGE_H__ */
diff --git a/ip/iplink_bridge.c b/ip/iplink_bridge.c
index 31e7cb5e..76e69086 100644
--- a/ip/iplink_bridge.c
+++ b/ip/iplink_bridge.c
@@ -682,62 +682,9 @@ static void bridge_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
rta_getattr_u8(tb[IFLA_BR_MCAST_QUERIER]));
if (tb[IFLA_BR_MCAST_QUERIER_STATE]) {
- struct rtattr *bqtb[BRIDGE_QUERIER_MAX + 1];
- SPRINT_BUF(other_time);
-
- parse_rtattr_nested(bqtb, BRIDGE_QUERIER_MAX, tb[IFLA_BR_MCAST_QUERIER_STATE]);
- memset(other_time, 0, sizeof(other_time));
-
- open_json_object("mcast_querier_state_ipv4");
- if (bqtb[BRIDGE_QUERIER_IP_ADDRESS]) {
- print_string(PRINT_FP,
- NULL,
- "%s ",
- "mcast_querier_ipv4_addr");
- print_color_string(PRINT_ANY,
- COLOR_INET,
- "mcast_querier_ipv4_addr",
- "%s ",
- format_host_rta(AF_INET, bqtb[BRIDGE_QUERIER_IP_ADDRESS]));
- }
- if (bqtb[BRIDGE_QUERIER_IP_PORT])
- print_uint(PRINT_ANY,
- "mcast_querier_ipv4_port",
- "mcast_querier_ipv4_port %u ",
- rta_getattr_u32(bqtb[BRIDGE_QUERIER_IP_PORT]));
- if (bqtb[BRIDGE_QUERIER_IP_OTHER_TIMER])
- print_string(PRINT_ANY,
- "mcast_querier_ipv4_other_timer",
- "mcast_querier_ipv4_other_timer %s ",
- sprint_time64(
- rta_getattr_u64(bqtb[BRIDGE_QUERIER_IP_OTHER_TIMER]),
- other_time));
- close_json_object();
- open_json_object("mcast_querier_state_ipv6");
- if (bqtb[BRIDGE_QUERIER_IPV6_ADDRESS]) {
- print_string(PRINT_FP,
- NULL,
- "%s ",
- "mcast_querier_ipv6_addr");
- print_color_string(PRINT_ANY,
- COLOR_INET6,
- "mcast_querier_ipv6_addr",
- "%s ",
- format_host_rta(AF_INET6, bqtb[BRIDGE_QUERIER_IPV6_ADDRESS]));
- }
- if (bqtb[BRIDGE_QUERIER_IPV6_PORT])
- print_uint(PRINT_ANY,
- "mcast_querier_ipv6_port",
- "mcast_querier_ipv6_port %u ",
- rta_getattr_u32(bqtb[BRIDGE_QUERIER_IPV6_PORT]));
- if (bqtb[BRIDGE_QUERIER_IPV6_OTHER_TIMER])
- print_string(PRINT_ANY,
- "mcast_querier_ipv6_other_timer",
- "mcast_querier_ipv6_other_timer %s ",
- sprint_time64(
- rta_getattr_u64(bqtb[BRIDGE_QUERIER_IPV6_OTHER_TIMER]),
- other_time));
- close_json_object();
+ struct rtattr *vtb = tb[IFLA_BR_MCAST_QUERIER_STATE];
+
+ bridge_print_mcast_querier_state(vtb);
}
if (tb[IFLA_BR_MCAST_HASH_ELASTICITY])
diff --git a/lib/bridge.c b/lib/bridge.c
index a888a20e..480693c9 100644
--- a/lib/bridge.c
+++ b/lib/bridge.c
@@ -45,3 +45,64 @@ void bridge_print_vlan_stats(const struct bridge_vlan_xstats *vstats)
close_json_object();
}
+
+void bridge_print_mcast_querier_state(const struct rtattr *vtb)
+{
+ struct rtattr *bqtb[BRIDGE_QUERIER_MAX + 1];
+
+ SPRINT_BUF(other_time);
+
+ parse_rtattr_nested(bqtb, BRIDGE_QUERIER_MAX, vtb);
+ memset(other_time, 0, sizeof(other_time));
+
+ open_json_object("mcast_querier_state_ipv4");
+ if (bqtb[BRIDGE_QUERIER_IP_ADDRESS]) {
+ print_string(PRINT_FP,
+ NULL,
+ "%s ",
+ "mcast_querier_ipv4_addr");
+ print_color_string(PRINT_ANY,
+ COLOR_INET,
+ "mcast_querier_ipv4_addr",
+ "%s ",
+ format_host_rta(AF_INET, bqtb[BRIDGE_QUERIER_IP_ADDRESS]));
+ }
+ if (bqtb[BRIDGE_QUERIER_IP_PORT])
+ print_uint(PRINT_ANY,
+ "mcast_querier_ipv4_port",
+ "mcast_querier_ipv4_port %u ",
+ rta_getattr_u32(bqtb[BRIDGE_QUERIER_IP_PORT]));
+ if (bqtb[BRIDGE_QUERIER_IP_OTHER_TIMER])
+ print_string(PRINT_ANY,
+ "mcast_querier_ipv4_other_timer",
+ "mcast_querier_ipv4_other_timer %s ",
+ sprint_time64(
+ rta_getattr_u64(bqtb[BRIDGE_QUERIER_IP_OTHER_TIMER]),
+ other_time));
+ close_json_object();
+ open_json_object("mcast_querier_state_ipv6");
+ if (bqtb[BRIDGE_QUERIER_IPV6_ADDRESS]) {
+ print_string(PRINT_FP,
+ NULL,
+ "%s ",
+ "mcast_querier_ipv6_addr");
+ print_color_string(PRINT_ANY,
+ COLOR_INET6,
+ "mcast_querier_ipv6_addr",
+ "%s ",
+ format_host_rta(AF_INET6, bqtb[BRIDGE_QUERIER_IPV6_ADDRESS]));
+ }
+ if (bqtb[BRIDGE_QUERIER_IPV6_PORT])
+ print_uint(PRINT_ANY,
+ "mcast_querier_ipv6_port",
+ "mcast_querier_ipv6_port %u ",
+ rta_getattr_u32(bqtb[BRIDGE_QUERIER_IPV6_PORT]));
+ if (bqtb[BRIDGE_QUERIER_IPV6_OTHER_TIMER])
+ print_string(PRINT_ANY,
+ "mcast_querier_ipv6_other_timer",
+ "mcast_querier_ipv6_other_timer %s ",
+ sprint_time64(
+ rta_getattr_u64(bqtb[BRIDGE_QUERIER_IPV6_OTHER_TIMER]),
+ other_time));
+ close_json_object();
+}
--
2.39.5
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH iproute2-next v5 2/3] bridge: dump mcast querier per vlan
2025-06-23 9:33 [PATCH iproute2-next v5 0/3] bridge: dump mcast querier state per vlan Fabian Pfitzner
2025-06-23 9:33 ` [PATCH iproute2-next v5 1/3] bridge: move mcast querier dumping code into a shared function Fabian Pfitzner
@ 2025-06-23 9:33 ` Fabian Pfitzner
2025-06-24 11:57 ` Ido Schimmel
2025-06-24 12:40 ` Nikolay Aleksandrov
2025-06-23 9:33 ` [PATCH iproute2-next v5 3/3] bridge: refactor bridge mcast querier function Fabian Pfitzner
2 siblings, 2 replies; 10+ messages in thread
From: Fabian Pfitzner @ 2025-06-23 9:33 UTC (permalink / raw)
To: netdev; +Cc: dsahern, idosch, bridge, entwicklung, razor, Fabian Pfitzner
Dump the multicast querier state per vlan.
This commit is almost identical to [1].
The querier state can be seen with:
bridge -d vlan global
The options for vlan filtering and vlan mcast snooping have to be enabled
in order to see the output:
ip link set [dev] type bridge mcast_vlan_snooping 1 vlan_filtering 1
The querier state shows the following information for IPv4 and IPv6
respectively:
1) The ip address of the current querier in the network. This could be
ourselves or an external querier.
2) The port on which the querier was seen
3) Querier timeout in seconds
[1] https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=16aa4494d7fc6543e5e92beb2ce01648b79f8fa2
Signed-off-by: Fabian Pfitzner <f.pfitzner@pengutronix.de>
---
bridge/vlan.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/bridge/vlan.c b/bridge/vlan.c
index 14b8475d..3c240207 100644
--- a/bridge/vlan.c
+++ b/bridge/vlan.c
@@ -852,6 +852,11 @@ static void print_vlan_global_opts(struct rtattr *a, int ifindex)
print_uint(PRINT_ANY, "mcast_querier", "mcast_querier %u ",
rta_getattr_u8(vattr));
}
+ if (vtb[BRIDGE_VLANDB_GOPTS_MCAST_QUERIER_STATE]) {
+ struct rtattr *attr = vtb[BRIDGE_VLANDB_GOPTS_MCAST_QUERIER_STATE];
+
+ bridge_print_mcast_querier_state(attr);
+ }
if (vtb[BRIDGE_VLANDB_GOPTS_MCAST_IGMP_VERSION]) {
vattr = vtb[BRIDGE_VLANDB_GOPTS_MCAST_IGMP_VERSION];
print_uint(PRINT_ANY, "mcast_igmp_version",
--
2.39.5
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH iproute2-next v5 3/3] bridge: refactor bridge mcast querier function
2025-06-23 9:33 [PATCH iproute2-next v5 0/3] bridge: dump mcast querier state per vlan Fabian Pfitzner
2025-06-23 9:33 ` [PATCH iproute2-next v5 1/3] bridge: move mcast querier dumping code into a shared function Fabian Pfitzner
2025-06-23 9:33 ` [PATCH iproute2-next v5 2/3] bridge: dump mcast querier per vlan Fabian Pfitzner
@ 2025-06-23 9:33 ` Fabian Pfitzner
2025-06-24 12:01 ` Ido Schimmel
2025-06-24 12:41 ` Nikolay Aleksandrov
2 siblings, 2 replies; 10+ messages in thread
From: Fabian Pfitzner @ 2025-06-23 9:33 UTC (permalink / raw)
To: netdev; +Cc: dsahern, idosch, bridge, entwicklung, razor, Fabian Pfitzner
Make code more readable and consistent with other functions.
Signed-off-by: Fabian Pfitzner <f.pfitzner@pengutronix.de>
---
lib/bridge.c | 72 +++++++++++++++++++++++++---------------------------
1 file changed, 34 insertions(+), 38 deletions(-)
diff --git a/lib/bridge.c b/lib/bridge.c
index 480693c9..23a102c4 100644
--- a/lib/bridge.c
+++ b/lib/bridge.c
@@ -49,60 +49,56 @@ void bridge_print_vlan_stats(const struct bridge_vlan_xstats *vstats)
void bridge_print_mcast_querier_state(const struct rtattr *vtb)
{
struct rtattr *bqtb[BRIDGE_QUERIER_MAX + 1];
+ const char *querier_ip;
SPRINT_BUF(other_time);
+ __u64 tval;
parse_rtattr_nested(bqtb, BRIDGE_QUERIER_MAX, vtb);
memset(other_time, 0, sizeof(other_time));
open_json_object("mcast_querier_state_ipv4");
if (bqtb[BRIDGE_QUERIER_IP_ADDRESS]) {
- print_string(PRINT_FP,
- NULL,
- "%s ",
- "mcast_querier_ipv4_addr");
- print_color_string(PRINT_ANY,
- COLOR_INET,
- "mcast_querier_ipv4_addr",
- "%s ",
- format_host_rta(AF_INET, bqtb[BRIDGE_QUERIER_IP_ADDRESS]));
+ querier_ip = format_host_rta(AF_INET,
+ bqtb[BRIDGE_QUERIER_IP_ADDRESS]);
+ print_string(PRINT_FP, NULL, "%s ",
+ "mcast_querier_ipv4_addr");
+ print_color_string(PRINT_ANY, COLOR_INET,
+ "mcast_querier_ipv4_addr", "%s ",
+ querier_ip);
}
if (bqtb[BRIDGE_QUERIER_IP_PORT])
- print_uint(PRINT_ANY,
- "mcast_querier_ipv4_port",
- "mcast_querier_ipv4_port %u ",
- rta_getattr_u32(bqtb[BRIDGE_QUERIER_IP_PORT]));
- if (bqtb[BRIDGE_QUERIER_IP_OTHER_TIMER])
+ print_uint(PRINT_ANY, "mcast_querier_ipv4_port",
+ "mcast_querier_ipv4_port %u ",
+ rta_getattr_u32(bqtb[BRIDGE_QUERIER_IP_PORT]));
+ if (bqtb[BRIDGE_QUERIER_IP_OTHER_TIMER]) {
+ tval = rta_getattr_u64(bqtb[BRIDGE_QUERIER_IP_OTHER_TIMER]);
print_string(PRINT_ANY,
- "mcast_querier_ipv4_other_timer",
- "mcast_querier_ipv4_other_timer %s ",
- sprint_time64(
- rta_getattr_u64(bqtb[BRIDGE_QUERIER_IP_OTHER_TIMER]),
- other_time));
+ "mcast_querier_ipv4_other_timer",
+ "mcast_querier_ipv4_other_timer %s ",
+ sprint_time64(tval, other_time));
+ }
close_json_object();
open_json_object("mcast_querier_state_ipv6");
if (bqtb[BRIDGE_QUERIER_IPV6_ADDRESS]) {
- print_string(PRINT_FP,
- NULL,
- "%s ",
- "mcast_querier_ipv6_addr");
- print_color_string(PRINT_ANY,
- COLOR_INET6,
- "mcast_querier_ipv6_addr",
- "%s ",
- format_host_rta(AF_INET6, bqtb[BRIDGE_QUERIER_IPV6_ADDRESS]));
+ querier_ip = format_host_rta(AF_INET6,
+ bqtb[BRIDGE_QUERIER_IPV6_ADDRESS]);
+ print_string(PRINT_FP, NULL, "%s ",
+ "mcast_querier_ipv6_addr");
+ print_color_string(PRINT_ANY, COLOR_INET6,
+ "mcast_querier_ipv6_addr", "%s ",
+ querier_ip);
}
if (bqtb[BRIDGE_QUERIER_IPV6_PORT])
- print_uint(PRINT_ANY,
- "mcast_querier_ipv6_port",
- "mcast_querier_ipv6_port %u ",
- rta_getattr_u32(bqtb[BRIDGE_QUERIER_IPV6_PORT]));
- if (bqtb[BRIDGE_QUERIER_IPV6_OTHER_TIMER])
+ print_uint(PRINT_ANY, "mcast_querier_ipv6_port",
+ "mcast_querier_ipv6_port %u ",
+ rta_getattr_u32(bqtb[BRIDGE_QUERIER_IPV6_PORT]));
+ if (bqtb[BRIDGE_QUERIER_IPV6_OTHER_TIMER]) {
+ tval = rta_getattr_u64(bqtb[BRIDGE_QUERIER_IPV6_OTHER_TIMER]);
print_string(PRINT_ANY,
- "mcast_querier_ipv6_other_timer",
- "mcast_querier_ipv6_other_timer %s ",
- sprint_time64(
- rta_getattr_u64(bqtb[BRIDGE_QUERIER_IPV6_OTHER_TIMER]),
- other_time));
+ "mcast_querier_ipv6_other_timer",
+ "mcast_querier_ipv6_other_timer %s ",
+ sprint_time64(tval, other_time));
+ }
close_json_object();
}
--
2.39.5
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH iproute2-next v5 1/3] bridge: move mcast querier dumping code into a shared function
2025-06-23 9:33 ` [PATCH iproute2-next v5 1/3] bridge: move mcast querier dumping code into a shared function Fabian Pfitzner
@ 2025-06-24 11:55 ` Ido Schimmel
2025-06-24 12:40 ` Nikolay Aleksandrov
1 sibling, 0 replies; 10+ messages in thread
From: Ido Schimmel @ 2025-06-24 11:55 UTC (permalink / raw)
To: Fabian Pfitzner; +Cc: netdev, dsahern, bridge, entwicklung, razor
On Mon, Jun 23, 2025 at 11:33:16AM +0200, Fabian Pfitzner wrote:
> Put mcast querier dumping code into a shared function. This function
> will be called from the bridge utility in a later patch.
>
> Adapt the code such that the vtb parameter is used
> instead of tb[IFLA_BR_MCAST_QUERIER_STATE].
>
> Signed-off-by: Fabian Pfitzner <f.pfitzner@pengutronix.de>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
[...]
> +void bridge_print_mcast_querier_state(const struct rtattr *vtb)
> +{
> + struct rtattr *bqtb[BRIDGE_QUERIER_MAX + 1];
> +
I assume you added the blank line because of checkpatch, but I think
it's wrong in this case.
> + SPRINT_BUF(other_time);
> +
> + parse_rtattr_nested(bqtb, BRIDGE_QUERIER_MAX, vtb);
> + memset(other_time, 0, sizeof(other_time));
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH iproute2-next v5 2/3] bridge: dump mcast querier per vlan
2025-06-23 9:33 ` [PATCH iproute2-next v5 2/3] bridge: dump mcast querier per vlan Fabian Pfitzner
@ 2025-06-24 11:57 ` Ido Schimmel
2025-06-24 12:40 ` Nikolay Aleksandrov
1 sibling, 0 replies; 10+ messages in thread
From: Ido Schimmel @ 2025-06-24 11:57 UTC (permalink / raw)
To: Fabian Pfitzner; +Cc: netdev, dsahern, bridge, entwicklung, razor
On Mon, Jun 23, 2025 at 11:33:18AM +0200, Fabian Pfitzner wrote:
> Dump the multicast querier state per vlan.
> This commit is almost identical to [1].
>
> The querier state can be seen with:
>
> bridge -d vlan global
>
> The options for vlan filtering and vlan mcast snooping have to be enabled
> in order to see the output:
>
> ip link set [dev] type bridge mcast_vlan_snooping 1 vlan_filtering 1
>
> The querier state shows the following information for IPv4 and IPv6
> respectively:
>
> 1) The ip address of the current querier in the network. This could be
> ourselves or an external querier.
> 2) The port on which the querier was seen
> 3) Querier timeout in seconds
>
> [1] https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=16aa4494d7fc6543e5e92beb2ce01648b79f8fa2
>
> Signed-off-by: Fabian Pfitzner <f.pfitzner@pengutronix.de>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH iproute2-next v5 3/3] bridge: refactor bridge mcast querier function
2025-06-23 9:33 ` [PATCH iproute2-next v5 3/3] bridge: refactor bridge mcast querier function Fabian Pfitzner
@ 2025-06-24 12:01 ` Ido Schimmel
2025-06-24 12:41 ` Nikolay Aleksandrov
1 sibling, 0 replies; 10+ messages in thread
From: Ido Schimmel @ 2025-06-24 12:01 UTC (permalink / raw)
To: Fabian Pfitzner; +Cc: netdev, dsahern, bridge, entwicklung, razor
On Mon, Jun 23, 2025 at 11:33:20AM +0200, Fabian Pfitzner wrote:
> Make code more readable and consistent with other functions.
>
> Signed-off-by: Fabian Pfitzner <f.pfitzner@pengutronix.de>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
> ---
> lib/bridge.c | 72 +++++++++++++++++++++++++---------------------------
> 1 file changed, 34 insertions(+), 38 deletions(-)
>
> diff --git a/lib/bridge.c b/lib/bridge.c
> index 480693c9..23a102c4 100644
> --- a/lib/bridge.c
> +++ b/lib/bridge.c
> @@ -49,60 +49,56 @@ void bridge_print_vlan_stats(const struct bridge_vlan_xstats *vstats)
> void bridge_print_mcast_querier_state(const struct rtattr *vtb)
> {
> struct rtattr *bqtb[BRIDGE_QUERIER_MAX + 1];
> + const char *querier_ip;
>
> SPRINT_BUF(other_time);
> + __u64 tval;
I suggest removing the blank line before "other_time"
>
> parse_rtattr_nested(bqtb, BRIDGE_QUERIER_MAX, vtb);
> memset(other_time, 0, sizeof(other_time));
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH iproute2-next v5 1/3] bridge: move mcast querier dumping code into a shared function
2025-06-23 9:33 ` [PATCH iproute2-next v5 1/3] bridge: move mcast querier dumping code into a shared function Fabian Pfitzner
2025-06-24 11:55 ` Ido Schimmel
@ 2025-06-24 12:40 ` Nikolay Aleksandrov
1 sibling, 0 replies; 10+ messages in thread
From: Nikolay Aleksandrov @ 2025-06-24 12:40 UTC (permalink / raw)
To: Fabian Pfitzner, netdev; +Cc: dsahern, idosch, bridge, entwicklung
On 6/23/25 12:33, Fabian Pfitzner wrote:
> Put mcast querier dumping code into a shared function. This function
> will be called from the bridge utility in a later patch.
>
> Adapt the code such that the vtb parameter is used
> instead of tb[IFLA_BR_MCAST_QUERIER_STATE].
>
> Signed-off-by: Fabian Pfitzner <f.pfitzner@pengutronix.de>
> ---
>
> I decided to not only move the code into a separate function, but also
> to adapt it to fit into the function. If I split it into a pure refactoring
> and an adapting commit, the former will not compile preventing git bisects.
>
> ---
> include/bridge.h | 3 +++
> ip/iplink_bridge.c | 59 +++-----------------------------------------
> lib/bridge.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 67 insertions(+), 56 deletions(-)
>
Acked-by: Nikolay Aleksandrov <razor@blackwall.org>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH iproute2-next v5 2/3] bridge: dump mcast querier per vlan
2025-06-23 9:33 ` [PATCH iproute2-next v5 2/3] bridge: dump mcast querier per vlan Fabian Pfitzner
2025-06-24 11:57 ` Ido Schimmel
@ 2025-06-24 12:40 ` Nikolay Aleksandrov
1 sibling, 0 replies; 10+ messages in thread
From: Nikolay Aleksandrov @ 2025-06-24 12:40 UTC (permalink / raw)
To: Fabian Pfitzner, netdev; +Cc: dsahern, idosch, bridge, entwicklung
On 6/23/25 12:33, Fabian Pfitzner wrote:
> Dump the multicast querier state per vlan.
> This commit is almost identical to [1].
>
> The querier state can be seen with:
>
> bridge -d vlan global
>
> The options for vlan filtering and vlan mcast snooping have to be enabled
> in order to see the output:
>
> ip link set [dev] type bridge mcast_vlan_snooping 1 vlan_filtering 1
>
> The querier state shows the following information for IPv4 and IPv6
> respectively:
>
> 1) The ip address of the current querier in the network. This could be
> ourselves or an external querier.
> 2) The port on which the querier was seen
> 3) Querier timeout in seconds
>
> [1] https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=16aa4494d7fc6543e5e92beb2ce01648b79f8fa2
>
> Signed-off-by: Fabian Pfitzner <f.pfitzner@pengutronix.de>
> ---
> bridge/vlan.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/bridge/vlan.c b/bridge/vlan.c
> index 14b8475d..3c240207 100644
> --- a/bridge/vlan.c
> +++ b/bridge/vlan.c
> @@ -852,6 +852,11 @@ static void print_vlan_global_opts(struct rtattr *a, int ifindex)
> print_uint(PRINT_ANY, "mcast_querier", "mcast_querier %u ",
> rta_getattr_u8(vattr));
> }
> + if (vtb[BRIDGE_VLANDB_GOPTS_MCAST_QUERIER_STATE]) {
> + struct rtattr *attr = vtb[BRIDGE_VLANDB_GOPTS_MCAST_QUERIER_STATE];
> +
> + bridge_print_mcast_querier_state(attr);
> + }
> if (vtb[BRIDGE_VLANDB_GOPTS_MCAST_IGMP_VERSION]) {
> vattr = vtb[BRIDGE_VLANDB_GOPTS_MCAST_IGMP_VERSION];
> print_uint(PRINT_ANY, "mcast_igmp_version",
> --
> 2.39.5
>
Acked-by: Nikolay Aleksandrov <razor@blackwall.org>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH iproute2-next v5 3/3] bridge: refactor bridge mcast querier function
2025-06-23 9:33 ` [PATCH iproute2-next v5 3/3] bridge: refactor bridge mcast querier function Fabian Pfitzner
2025-06-24 12:01 ` Ido Schimmel
@ 2025-06-24 12:41 ` Nikolay Aleksandrov
1 sibling, 0 replies; 10+ messages in thread
From: Nikolay Aleksandrov @ 2025-06-24 12:41 UTC (permalink / raw)
To: Fabian Pfitzner, netdev; +Cc: dsahern, idosch, bridge, entwicklung
On 6/23/25 12:33, Fabian Pfitzner wrote:
> Make code more readable and consistent with other functions.
>
> Signed-off-by: Fabian Pfitzner <f.pfitzner@pengutronix.de>
> ---
> lib/bridge.c | 72 +++++++++++++++++++++++++---------------------------
> 1 file changed, 34 insertions(+), 38 deletions(-)
>
+1 for Ido's suggestion to remove the blank line, checkpatch isn't always
right :) but it's a minor nit, looks good to me overall:
Acked-by: Nikolay Aleksandrov <razor@blackwall.org>
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2025-06-24 12:41 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-23 9:33 [PATCH iproute2-next v5 0/3] bridge: dump mcast querier state per vlan Fabian Pfitzner
2025-06-23 9:33 ` [PATCH iproute2-next v5 1/3] bridge: move mcast querier dumping code into a shared function Fabian Pfitzner
2025-06-24 11:55 ` Ido Schimmel
2025-06-24 12:40 ` Nikolay Aleksandrov
2025-06-23 9:33 ` [PATCH iproute2-next v5 2/3] bridge: dump mcast querier per vlan Fabian Pfitzner
2025-06-24 11:57 ` Ido Schimmel
2025-06-24 12:40 ` Nikolay Aleksandrov
2025-06-23 9:33 ` [PATCH iproute2-next v5 3/3] bridge: refactor bridge mcast querier function Fabian Pfitzner
2025-06-24 12:01 ` Ido Schimmel
2025-06-24 12:41 ` Nikolay Aleksandrov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).