]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
mlxsw: spectrum_router: Skip loopback RIFs during MAC validation
authorAmit Cohen <amitc@mellanox.com>
Sun, 29 Dec 2019 11:40:22 +0000 (13:40 +0200)
committerSeth Forshee <seth.forshee@canonical.com>
Mon, 6 Jan 2020 16:12:14 +0000 (10:12 -0600)
BugLink: https://bugs.launchpad.net/bugs/1858429
[ Upstream commit 314bd842d98e1035cc40b671a71e07f48420e58f ]

When a router interface (RIF) is created the MAC address of the backing
netdev is verified to have the same MSBs as existing RIFs. This is
required in order to avoid changing existing RIF MAC addresses that all
share the same MSBs.

Loopback RIFs are special in this regard as they do not have a MAC
address, given they are only used to loop packets from the overlay to
the underlay.

Without this change, an error is returned when trying to create a RIF
after the creation of a GRE tunnel that is represented by a loopback
RIF. 'rif->dev->dev_addr' points to the GRE device's local IP, which
does not share the same MSBs as physical interfaces. Adding an IP
address to any physical interface results in:

Error: mlxsw_spectrum: All router interface MAC addresses must have the
same prefix.

Fix this by skipping loopback RIFs during MAC validation.

Fixes: 74bc99397438 ("mlxsw: spectrum_router: Veto unsupported RIF MAC addresses")
Signed-off-by: Amit Cohen <amitc@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c

index 210ebc91d3d6967485970813fdc1565b4fc59f07..efdf8cb5114c2fcf836e926ba8db856d0dd499e1 100644 (file)
@@ -6985,6 +6985,9 @@ static int mlxsw_sp_router_port_check_rif_addr(struct mlxsw_sp *mlxsw_sp,
 
        for (i = 0; i < MLXSW_CORE_RES_GET(mlxsw_sp->core, MAX_RIFS); i++) {
                rif = mlxsw_sp->router->rifs[i];
+               if (rif && rif->ops &&
+                   rif->ops->type == MLXSW_SP_RIF_TYPE_IPIP_LB)
+                       continue;
                if (rif && rif->dev && rif->dev != dev &&
                    !ether_addr_equal_masked(rif->dev->dev_addr, dev_addr,
                                             mlxsw_sp->mac_mask)) {