All of lore.kernel.org
 help / color / mirror / Atom feed
* Fw: [Bug 203137] New: Bridge does not forward multicast if multicast_querier is enabled
@ 2019-04-03 18:53 Stephen Hemminger
  2019-04-03 19:57 ` Nikolay Aleksandrov
  0 siblings, 1 reply; 6+ messages in thread
From: Stephen Hemminger @ 2019-04-03 18:53 UTC (permalink / raw)
  To: roopa, nikolay; +Cc: netdev



Begin forwarded message:

Date: Wed, 03 Apr 2019 04:49:49 +0000
From: bugzilla-daemon@bugzilla.kernel.org
To: stephen@networkplumber.org
Subject: [Bug 203137] New: Bridge does not forward multicast if multicast_querier is enabled


https://bugzilla.kernel.org/show_bug.cgi?id=203137

            Bug ID: 203137
           Summary: Bridge does not forward multicast if multicast_querier
                    is enabled
           Product: Networking
           Version: 2.5
    Kernel Version: 5.0.3
          Hardware: All
                OS: Linux
              Tree: Fedora
            Status: NEW
          Severity: normal
          Priority: P1
         Component: Other
          Assignee: stephen@networkplumber.org
          Reporter: liam.mcbirnie@boeing.com
        Regression: Yes

When multicast querier is enabled on a bridge, multicasts are not forwarded
according to the multicast forwarding database.

"bridge mdb" shows the multicast forwarding entries but they are not forwarded
to the ports.
Manually adding the port to the bridge multicast DB works.

Wireshark shows the packets arriving on the bridge but not being sent out the
proper port.

The regression was introduced by commit
19e3a9c90c53479fecaa02307bf2db5ab8b3ffe3, "net: bridge: convert multicast to
generic rhashtable" by Nikolay Aleksandrov <nikolay@cumulusnetworks.com>.

Steps to reproduce:

ip link add br0 type bridge mcast_querier 1
ip link set br0 up

ip link add v2 type veth peer name v3
ip link set v2 master br0
ip link set v2 up
ip link set v3 up
ip addr add 3.0.0.2/24 dev v3

ip netns add test
ip link add v1 type veth peer name v1 netns test
ip link set v1 master br0
ip link set v1 up
ip -n test link set v1 up
ip -n test addr add 3.0.0.1/24 dev v1

# Multicast receiver
ip netns exec test socat
UDP4-RECVFROM:5588,ip-add-membership=224.224.224.224:3.0.0.1,fork -

# Multicast sender
echo hello | nc -u -s 3.0.0.2 224.224.224.224 5588

Observe that 'bridge mdb' has an entry for 224.224.224.224 on port v1.
Observe that the multicast packets are seen on v2, v3 and br0 but not v1.

-- 
You are receiving this mail because:
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Fw: [Bug 203137] New: Bridge does not forward multicast if multicast_querier is enabled
  2019-04-03 18:53 Fw: [Bug 203137] New: Bridge does not forward multicast if multicast_querier is enabled Stephen Hemminger
@ 2019-04-03 19:57 ` Nikolay Aleksandrov
  2019-04-03 20:27     ` [Bridge] " Nikolay Aleksandrov
  0 siblings, 1 reply; 6+ messages in thread
From: Nikolay Aleksandrov @ 2019-04-03 19:57 UTC (permalink / raw)
  To: Stephen Hemminger, roopa; +Cc: netdev

On 03/04/2019 21:53, Stephen Hemminger wrote:
> 
> 
> Begin forwarded message:
> 
> Date: Wed, 03 Apr 2019 04:49:49 +0000
> From: bugzilla-daemon@bugzilla.kernel.org
> To: stephen@networkplumber.org
> Subject: [Bug 203137] New: Bridge does not forward multicast if multicast_querier is enabled
> 
> 
> https://bugzilla.kernel.org/show_bug.cgi?id=203137
> 
>             Bug ID: 203137
>            Summary: Bridge does not forward multicast if multicast_querier
>                     is enabled
>            Product: Networking
>            Version: 2.5
>     Kernel Version: 5.0.3
>           Hardware: All
>                 OS: Linux
>               Tree: Fedora
>             Status: NEW
>           Severity: normal
>           Priority: P1
>          Component: Other
>           Assignee: stephen@networkplumber.org
>           Reporter: liam.mcbirnie@boeing.com
>         Regression: Yes
> 
> When multicast querier is enabled on a bridge, multicasts are not forwarded
> according to the multicast forwarding database.
> 
> "bridge mdb" shows the multicast forwarding entries but they are not forwarded
> to the ports.
> Manually adding the port to the bridge multicast DB works.
> 
> Wireshark shows the packets arriving on the bridge but not being sent out the
> proper port.
> 
> The regression was introduced by commit
> 19e3a9c90c53479fecaa02307bf2db5ab8b3ffe3, "net: bridge: convert multicast to
> generic rhashtable" by Nikolay Aleksandrov <nikolay@cumulusnetworks.com>.
> 
> Steps to reproduce:
> 
> ip link add br0 type bridge mcast_querier 1
> ip link set br0 up
> 
> ip link add v2 type veth peer name v3
> ip link set v2 master br0
> ip link set v2 up
> ip link set v3 up
> ip addr add 3.0.0.2/24 dev v3
> 
> ip netns add test
> ip link add v1 type veth peer name v1 netns test
> ip link set v1 master br0
> ip link set v1 up
> ip -n test link set v1 up
> ip -n test addr add 3.0.0.1/24 dev v1
> 
> # Multicast receiver
> ip netns exec test socat
> UDP4-RECVFROM:5588,ip-add-membership=224.224.224.224:3.0.0.1,fork -
> 
> # Multicast sender
> echo hello | nc -u -s 3.0.0.2 224.224.224.224 5588
> 
> Observe that 'bridge mdb' has an entry for 224.224.224.224 on port v1.
> Observe that the multicast packets are seen on v2, v3 and br0 but not v1.
> 

I saw the issue, I've missed one memset during the conversion.
Will send a patch after running some tests.

Thanks!


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH net] net: bridge: always clear mcast matching struct on reports and leaves
  2019-04-03 19:57 ` Nikolay Aleksandrov
@ 2019-04-03 20:27     ` Nikolay Aleksandrov
  0 siblings, 0 replies; 6+ messages in thread
From: Nikolay Aleksandrov @ 2019-04-03 20:27 UTC (permalink / raw)
  To: netdev; +Cc: liam.mcbirnie, roopa, stephen, bridge, Nikolay Aleksandrov

We need to be careful and always zero the whole br_ip struct when it is
used for matching since the rhashtable change. This patch fixes all the
places which didn't properly clear it which in turn might've caused
mismatches.

Thanks for the great bug report with reproducing steps and bisection.

Steps to reproduce (from the bug report):
ip link add br0 type bridge mcast_querier 1
ip link set br0 up

ip link add v2 type veth peer name v3
ip link set v2 master br0
ip link set v2 up
ip link set v3 up
ip addr add 3.0.0.2/24 dev v3

ip netns add test
ip link add v1 type veth peer name v1 netns test
ip link set v1 master br0
ip link set v1 up
ip -n test link set v1 up
ip -n test addr add 3.0.0.1/24 dev v1

# Multicast receiver
ip netns exec test socat
UDP4-RECVFROM:5588,ip-add-membership=224.224.224.224:3.0.0.1,fork -

# Multicast sender
echo hello | nc -u -s 3.0.0.2 224.224.224.224 5588

Reported-by: liam.mcbirnie@boeing.com
Fixes: 19e3a9c90c53 ("net: bridge: convert multicast to generic rhashtable")
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
---
I will cook a selftest for this as well.

 net/bridge/br_multicast.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
index a0e369179f6d..02da21d771c9 100644
--- a/net/bridge/br_multicast.c
+++ b/net/bridge/br_multicast.c
@@ -601,6 +601,7 @@ static int br_ip4_multicast_add_group(struct net_bridge *br,
 	if (ipv4_is_local_multicast(group))
 		return 0;
 
+	memset(&br_group, 0, sizeof(br_group));
 	br_group.u.ip4 = group;
 	br_group.proto = htons(ETH_P_IP);
 	br_group.vid = vid;
@@ -1497,6 +1498,7 @@ static void br_ip4_multicast_leave_group(struct net_bridge *br,
 
 	own_query = port ? &port->ip4_own_query : &br->ip4_own_query;
 
+	memset(&br_group, 0, sizeof(br_group));
 	br_group.u.ip4 = group;
 	br_group.proto = htons(ETH_P_IP);
 	br_group.vid = vid;
@@ -1520,6 +1522,7 @@ static void br_ip6_multicast_leave_group(struct net_bridge *br,
 
 	own_query = port ? &port->ip6_own_query : &br->ip6_own_query;
 
+	memset(&br_group, 0, sizeof(br_group));
 	br_group.u.ip6 = *group;
 	br_group.proto = htons(ETH_P_IPV6);
 	br_group.vid = vid;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Bridge] [PATCH net] net: bridge: always clear mcast matching struct on reports and leaves
@ 2019-04-03 20:27     ` Nikolay Aleksandrov
  0 siblings, 0 replies; 6+ messages in thread
From: Nikolay Aleksandrov @ 2019-04-03 20:27 UTC (permalink / raw)
  To: netdev; +Cc: liam.mcbirnie, roopa, bridge, Nikolay Aleksandrov

We need to be careful and always zero the whole br_ip struct when it is
used for matching since the rhashtable change. This patch fixes all the
places which didn't properly clear it which in turn might've caused
mismatches.

Thanks for the great bug report with reproducing steps and bisection.

Steps to reproduce (from the bug report):
ip link add br0 type bridge mcast_querier 1
ip link set br0 up

ip link add v2 type veth peer name v3
ip link set v2 master br0
ip link set v2 up
ip link set v3 up
ip addr add 3.0.0.2/24 dev v3

ip netns add test
ip link add v1 type veth peer name v1 netns test
ip link set v1 master br0
ip link set v1 up
ip -n test link set v1 up
ip -n test addr add 3.0.0.1/24 dev v1

# Multicast receiver
ip netns exec test socat
UDP4-RECVFROM:5588,ip-add-membership=224.224.224.224:3.0.0.1,fork -

# Multicast sender
echo hello | nc -u -s 3.0.0.2 224.224.224.224 5588

Reported-by: liam.mcbirnie@boeing.com
Fixes: 19e3a9c90c53 ("net: bridge: convert multicast to generic rhashtable")
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
---
I will cook a selftest for this as well.

 net/bridge/br_multicast.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
index a0e369179f6d..02da21d771c9 100644
--- a/net/bridge/br_multicast.c
+++ b/net/bridge/br_multicast.c
@@ -601,6 +601,7 @@ static int br_ip4_multicast_add_group(struct net_bridge *br,
 	if (ipv4_is_local_multicast(group))
 		return 0;
 
+	memset(&br_group, 0, sizeof(br_group));
 	br_group.u.ip4 = group;
 	br_group.proto = htons(ETH_P_IP);
 	br_group.vid = vid;
@@ -1497,6 +1498,7 @@ static void br_ip4_multicast_leave_group(struct net_bridge *br,
 
 	own_query = port ? &port->ip4_own_query : &br->ip4_own_query;
 
+	memset(&br_group, 0, sizeof(br_group));
 	br_group.u.ip4 = group;
 	br_group.proto = htons(ETH_P_IP);
 	br_group.vid = vid;
@@ -1520,6 +1522,7 @@ static void br_ip6_multicast_leave_group(struct net_bridge *br,
 
 	own_query = port ? &port->ip6_own_query : &br->ip6_own_query;
 
+	memset(&br_group, 0, sizeof(br_group));
 	br_group.u.ip6 = *group;
 	br_group.proto = htons(ETH_P_IPV6);
 	br_group.vid = vid;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net] net: bridge: always clear mcast matching struct on reports and leaves
  2019-04-03 20:27     ` [Bridge] " Nikolay Aleksandrov
@ 2019-04-05  0:53       ` David Miller
  -1 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2019-04-05  0:53 UTC (permalink / raw)
  To: nikolay; +Cc: netdev, liam.mcbirnie, roopa, stephen, bridge

From: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Date: Wed,  3 Apr 2019 23:27:24 +0300

> We need to be careful and always zero the whole br_ip struct when it is
> used for matching since the rhashtable change. This patch fixes all the
> places which didn't properly clear it which in turn might've caused
> mismatches.
> 
> Thanks for the great bug report with reproducing steps and bisection.
 ...
> Reported-by: liam.mcbirnie@boeing.com
> Fixes: 19e3a9c90c53 ("net: bridge: convert multicast to generic rhashtable")
> Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>

Applied and queued up for -stable.

> I will cook a selftest for this as well.

Thanks in advance for this, that's great.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Bridge] [PATCH net] net: bridge: always clear mcast matching struct on reports and leaves
@ 2019-04-05  0:53       ` David Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2019-04-05  0:53 UTC (permalink / raw)
  To: nikolay; +Cc: netdev, roopa, bridge, liam.mcbirnie

From: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Date: Wed,  3 Apr 2019 23:27:24 +0300

> We need to be careful and always zero the whole br_ip struct when it is
> used for matching since the rhashtable change. This patch fixes all the
> places which didn't properly clear it which in turn might've caused
> mismatches.
> 
> Thanks for the great bug report with reproducing steps and bisection.
 ...
> Reported-by: liam.mcbirnie@boeing.com
> Fixes: 19e3a9c90c53 ("net: bridge: convert multicast to generic rhashtable")
> Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>

Applied and queued up for -stable.

> I will cook a selftest for this as well.

Thanks in advance for this, that's great.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-04-05  0:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-03 18:53 Fw: [Bug 203137] New: Bridge does not forward multicast if multicast_querier is enabled Stephen Hemminger
2019-04-03 19:57 ` Nikolay Aleksandrov
2019-04-03 20:27   ` [PATCH net] net: bridge: always clear mcast matching struct on reports and leaves Nikolay Aleksandrov
2019-04-03 20:27     ` [Bridge] " Nikolay Aleksandrov
2019-04-05  0:53     ` David Miller
2019-04-05  0:53       ` [Bridge] " David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.