• Alexis Bauvin's avatar
    vxlan: add support for underlay in non-default VRF · aab8cc36
    Alexis Bauvin authored
    Creating a VXLAN device with is underlay in the non-default VRF makes
    egress route lookup fail or incorrect since it will resolve in the
    default VRF, and ingress fail because the socket listens in the default
    VRF.
    
    This patch binds the underlying UDP tunnel socket to the l3mdev of the
    lower device of the VXLAN device. This will listen in the proper VRF and
    output traffic from said l3mdev, matching l3mdev routing rules and
    looking up the correct routing table.
    
    When the VXLAN device does not have a lower device, or the lower device
    is in the default VRF, the socket will not be bound to any interface,
    keeping the previous behaviour.
    
    The underlay l3mdev is deduced from the VXLAN lower device
    (IFLA_VXLAN_LINK).
    
    +----------+                         +---------+
    |          |                         |         |
    | vrf-blue |                         | vrf-red |
    |          |                         |         |
    +----+-----+                         +----+----+
         |                                    |
         |                                    |
    +----+-----+                         +----+----+
    |          |                         |         |
    | br-blue  |                         | br-red  |
    |          |                         |         |
    +----+-----+                         +---+-+---+
         |                                   | |
         |                             +-----+ +-----+
         |                             |             |
    +----+-----+                +------+----+   +----+----+
    |          |  lower device  |           |   |         |
    |   eth0   | <- - - - - - - | vxlan-red |   | tap-red | (... more taps)
    |          |                |           |   |         |
    +----------+                +-----------+   +---------+
    Signed-off-by: default avatarAlexis Bauvin <abauvin@scaleway.com>
    Reviewed-by: default avatarAmine Kherbouche <akherbouche@scaleway.com>
    Reviewed-by: default avatarDavid Ahern <dsahern@gmail.com>
    Tested-by: default avatarAmine Kherbouche <akherbouche@scaleway.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    aab8cc36
vxlan.c 104 KB