Ethernet Bridge development
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@nvidia.com>
To: netdev@vger.kernel.org, bridge@lists.linux-foundation.org
Cc: petrm@nvidia.com, mlxsw@nvidia.com, razor@blackwall.org,
	Ido Schimmel <idosch@nvidia.com>,
	edumazet@google.com, roopa@nvidia.com, kuba@kernel.org,
	pabeni@redhat.com, davem@davemloft.net
Subject: [Bridge] [RFC PATCH net-next 07/13] rtnetlink: bridge: mcast: Relax group address validation in common code
Date: Sat,  4 Feb 2023 19:07:55 +0200	[thread overview]
Message-ID: <20230204170801.3897900-8-idosch@nvidia.com> (raw)
In-Reply-To: <20230204170801.3897900-1-idosch@nvidia.com>

In the upcoming VXLAN MDB implementation, the 0.0.0.0 and :: MDB entries
will act as catchall entries for unregistered IP multicast traffic in a
similar fashion to the 00:00:00:00:00:00 VXLAN FDB entry that is used to
transmit BUM traffic.

In deployments where inter-subnet multicast forwarding is used, not all
the VTEPs in a tenant domain are members in all the broadcast domains.
It is therefore advantageous to transmit BULL (broadcast, unknown
unicast and link-local multicast) and unregistered IP multicast traffic
on different tunnels. If the same tunnel was used, a VTEP only
interested in IP multicast traffic would also pull all the BULL traffic
and drop it as it is not a member in the originating broadcast domain
[1].

Prepare for this change by allowing the 0.0.0.0 group address in the
common rtnetlink MDB code and forbid it in the bridge driver. A similar
change is not needed for IPv6 because the common code only validates
that the group address is not the all-nodes address.

[1] https://datatracker.ietf.org/doc/html/draft-ietf-bess-evpn-irb-mcast#section-2.6

Signed-off-by: Ido Schimmel <idosch@nvidia.com>
---
 net/bridge/br_mdb.c  | 6 ++++++
 net/core/rtnetlink.c | 5 +++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c
index f970980e6183..88f0519520d2 100644
--- a/net/bridge/br_mdb.c
+++ b/net/bridge/br_mdb.c
@@ -1249,6 +1249,12 @@ static int br_mdb_config_init(struct br_mdb_config *cfg, struct net_device *dev,
 		}
 	}
 
+	if (cfg->entry->addr.proto == htons(ETH_P_IP) &&
+	    ipv4_is_zeronet(cfg->entry->addr.u.ip4)) {
+		NL_SET_ERR_MSG_MOD(extack, "IPv4 entry group address 0.0.0.0 is not allowed");
+		return -EINVAL;
+	}
+
 	if (tb[MDBA_SET_ENTRY_ATTRS])
 		return br_mdb_config_attrs_init(tb[MDBA_SET_ENTRY_ATTRS], cfg,
 						extack);
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 892d4e8fd394..1c7a8cbc4ce1 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -6149,8 +6149,9 @@ static int rtnl_validate_mdb_entry(const struct nlattr *attr,
 	}
 
 	if (entry->addr.proto == htons(ETH_P_IP)) {
-		if (!ipv4_is_multicast(entry->addr.u.ip4)) {
-			NL_SET_ERR_MSG(extack, "IPv4 entry group address is not multicast");
+		if (!ipv4_is_multicast(entry->addr.u.ip4) &&
+		    !ipv4_is_zeronet(entry->addr.u.ip4)) {
+			NL_SET_ERR_MSG(extack, "IPv4 entry group address is not multicast or 0.0.0.0");
 			return -EINVAL;
 		}
 		if (ipv4_is_local_multicast(entry->addr.u.ip4)) {
-- 
2.37.3


  parent reply	other threads:[~2023-02-04 17:07 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-04 17:07 [Bridge] [RFC PATCH net-next 00/13] vxlan: Add MDB support Ido Schimmel
2023-02-04 17:07 ` [Bridge] [RFC PATCH net-next 01/13] bridge: mcast: Use correct define in MDB dump Ido Schimmel
2023-02-04 17:07 ` [Bridge] [RFC PATCH net-next 02/13] bridge: mcast: Remove pointless sequence generation counter assignment Ido Schimmel
2023-02-04 17:07 ` [Bridge] [RFC PATCH net-next 03/13] bridge: mcast: Move validation to a policy Ido Schimmel
2023-02-04 17:07 ` [Bridge] [RFC PATCH net-next 04/13] net: Add MDB net device operations Ido Schimmel
2023-02-04 17:07 ` [Bridge] [RFC PATCH net-next 05/13] bridge: mcast: Implement " Ido Schimmel
2023-02-04 17:07 ` [Bridge] [RFC PATCH net-next 06/13] rtnetlink: bridge: mcast: Move MDB handlers out of bridge driver Ido Schimmel
2023-02-04 17:07 ` Ido Schimmel [this message]
2023-02-04 17:07 ` [Bridge] [RFC PATCH net-next 08/13] vxlan: Move address helpers to private headers Ido Schimmel
2023-02-04 17:07 ` [Bridge] [RFC PATCH net-next 09/13] vxlan: Expose vxlan_xmit_one() Ido Schimmel
2023-02-04 17:07 ` [Bridge] [RFC PATCH net-next 10/13] vxlan: mdb: Add MDB control path support Ido Schimmel
2023-02-04 17:07 ` [Bridge] [RFC PATCH net-next 11/13] vxlan: mdb: Add an internal flag to indicate MDB usage Ido Schimmel
2023-02-04 17:08 ` [Bridge] [RFC PATCH net-next 12/13] vxlan: Add MDB data path support Ido Schimmel
2023-02-04 17:08 ` [Bridge] [RFC PATCH net-next 13/13] vxlan: Enable MDB support Ido Schimmel
2023-02-06 23:24 ` [Bridge] [RFC PATCH net-next 00/13] vxlan: Add " Nikolay Aleksandrov
2023-02-07  9:25   ` Ido Schimmel
2023-02-07 21:02     ` Nikolay Aleksandrov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230204170801.3897900-8-idosch@nvidia.com \
    --to=idosch@nvidia.com \
    --cc=bridge@lists.linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=mlxsw@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=petrm@nvidia.com \
    --cc=razor@blackwall.org \
    --cc=roopa@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox