• Amit Cohen's avatar
    mlxsw: spectrum_router: Skip loopback RIFs during MAC validation · 314bd842
    Amit Cohen authored
    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: 74bc9939 ("mlxsw: spectrum_router: Veto unsupported RIF MAC addresses")
    Signed-off-by: default avatarAmit Cohen <amitc@mellanox.com>
    Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    314bd842
spectrum_router.c 220 KB