vxlan: drop packets from invalid src-address
Subsystems (2)
PATCH 1/1 vxlan: drop packets from invalid src-address
The VXLAN driver currently does not check if the inner layer2 source-address is valid.
In case source-address snooping/learning is enabled, a entry in the FDB for the invalid address is created with the layer3 address of the tunnel endpoint.
If the frame happens to have a non-unicast address set, all this non-unicast traffic is subsequently not flooded to the tunnel network but sent to the learnt host in the FDB. To make matters worse, this FDB entry does not expire.
Apply the same filtering for packets as it is done for bridges. This not only drops these invalid packets but avoids them from being learnt into the FDB.
--- drivers/net/vxlan/vxlan_core.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/vxlan/vxlan_core.c +4 -0
@@ -1615,6 +1615,10 @@ static bool vxlan_set_mac(struct vxlan_dev *vxlan,if (ether_addr_equal (eth_hdr (skb)->h_source, vxlan->dev->dev_addr))return false; +/* Ignore packets from invalid src-address */ +if (!is_valid_ether_addr (eth_hdr (skb)->h_source)) +return false; +/* Get address from the outer IP header */ if (vxlan_get_sk_family (vs) ==AF_INET ) { saddr.sin.sin_addr.s_addr =ip_hdr (skb)->saddr;
Signature · 1 line
2.43.0
Quoted 6 lines · David Bauer
The VXLAN driver currently does not check if the inner layer2 source-address is valid.
In case source-address snooping/learning is enabled, a entry in the FDB for the invalid address is created with the layer3 address of the tunnel endpoint.
what is root cause of creation of invalid MAC from an L3 address ? could you add that as well to commit message.
Quoted 34 lines
If the frame happens to have a non-unicast address set, all this non-unicast traffic is subsequently not flooded to the tunnel network but sent to the learnt host in the FDB. To make matters worse, this FDB entry does not expire.
Apply the same filtering for packets as it is done for bridges. This not only drops these invalid packets but avoids them from being learnt into the FDB.
Suggested-by Ido Schimmel <[email protected]>Signed-off-by David Bauer <[email protected]>--- drivers/net/vxlan/vxlan_core.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/net/vxlan/vxlan_core.c +4
-1@@ -1615,6 +1615,10 @@ static bool vxlan_set_mac(struct vxlan_dev *vxlan,if (ether_addr_equal (eth_hdr (skb)->h_source, vxlan->dev->dev_addr))return false; +/* Ignore packets from invalid src-address */ +if (!is_valid_ether_addr (eth_hdr (skb)->h_source)) +return false; +/* Get address from the outer IP header */ if (vxlan_get_sk_family (vs) ==AF_INET ) { saddr.sin.sin_addr.s_addr =ip_hdr (skb)->saddr; --2.43.0
Hello Ratheesh,
Quoted 9 lines · Ratheesh Kannoth
Quoted 6 lines · David Bauer
The VXLAN driver currently does not check if the inner layer2 source-address is valid.
In case source-address snooping/learning is enabled, a entry in the FDB for the invalid address is created with the layer3 address of the tunnel endpoint.
what is root cause of creation of invalid MAC from an L3 address ? could you add that as well to commit message.
I sadly can not elaborate on this further as the state happens sporadically after weeks of operation. For more details, see
https://lore.kernel.org/all/[email protected]/T/
Best
David
Quoted 35 lines
Quoted 35 lines
If the frame happens to have a non-unicast address set, all this non-unicast traffic is subsequently not flooded to the tunnel network but sent to the learnt host in the FDB. To make matters worse, this FDB entry does not expire.
Apply the same filtering for packets as it is done for bridges. This not only drops these invalid packets but avoids them from being learnt into the FDB.
Suggested-by Ido Schimmel <[email protected]>Signed-off-by David Bauer <[email protected]>--- drivers/net/vxlan/vxlan_core.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/net/vxlan/vxlan_core.c +4
-1@@ -1615,6 +1615,10 @@ static bool vxlan_set_mac(struct vxlan_dev *vxlan,if (ether_addr_equal (eth_hdr (skb)->h_source, vxlan->dev->dev_addr))return false; +/* Ignore packets from invalid src-address */ +if (!is_valid_ether_addr (eth_hdr (skb)->h_source)) +return false; +/* Get address from the outer IP header */ if (vxlan_get_sk_family (vs) ==AF_INET ) { saddr.sin.sin_addr.s_addr =ip_hdr (skb)->saddr; --2.43.0
Simon Horman
reviewerQuoted 12 lines · David Bauer
The VXLAN driver currently does not check if the inner layer2 source-address is valid.
In case source-address snooping/learning is enabled, a entry in the FDB for the invalid address is created with the layer3 address of the tunnel endpoint.
If the frame happens to have a non-unicast address set, all this non-unicast traffic is subsequently not flooded to the tunnel network but sent to the learnt host in the FDB. To make matters worse, this FDB entry does not expire.
Quoted 6 lines
Apply the same filtering for packets as it is done for bridges. This not only drops these invalid packets but avoids them from being learnt into the FDB.
Suggested-by Ido Schimmel <[email protected]>Signed-off-by David Bauer <[email protected]>
Hi David and Ido,
I wonder if this is an appropriate candidate for 'net', with a Fixes tag. It does seem to address a user-visible problem.
...
Quoted 17 lines · Simon Horman
Quoted 16 lines · David Bauer
The VXLAN driver currently does not check if the inner layer2 source-address is valid.
In case source-address snooping/learning is enabled, a entry in the FDB for the invalid address is created with the layer3 address of the tunnel endpoint.
If the frame happens to have a non-unicast address set, all this non-unicast traffic is subsequently not flooded to the tunnel network but sent to the learnt host in the FDB. To make matters worse, this FDB entry does not expire.
Apply the same filtering for packets as it is done for bridges. This not only drops these invalid packets but avoids them from being learnt into the FDB.
Quoted 7 lines
Quoted 2 lines
Suggested-by Ido Schimmel <[email protected]>Signed-off-by David Bauer <[email protected]>Hi David and Ido,
I wonder if this is an appropriate candidate for 'net', with a Fixes tag. It does seem to address a user-visible problem.
I'm OK with targeting the patch at 'net'. Looking at git history, the issue seems to be present since initial submission so Fixes tag should be:
David, can you please re-submit with "[PATCH net]" prefix and the above tag?
Thanks
Hi Ido,
Quoted 26 lines · Ido Schimmel
Quoted 17 lines · Simon Horman
Quoted 16 lines · David Bauer
The VXLAN driver currently does not check if the inner layer2 source-address is valid.
In case source-address snooping/learning is enabled, a entry in the FDB for the invalid address is created with the layer3 address of the tunnel endpoint.
If the frame happens to have a non-unicast address set, all this non-unicast traffic is subsequently not flooded to the tunnel network but sent to the learnt host in the FDB. To make matters worse, this FDB entry does not expire.
Apply the same filtering for packets as it is done for bridges. This not only drops these invalid packets but avoids them from being learnt into the FDB.
Quoted 7 lines
Quoted 2 lines
Suggested-by Ido Schimmel <[email protected]>Signed-off-by David Bauer <[email protected]>Hi David and Ido,
I wonder if this is an appropriate candidate for 'net', with a Fixes tag. It does seem to address a user-visible problem.
Quoted 8 lines
I'm OK with targeting the patch at 'net'. Looking at git history, the issue seems to be present since initial submission so Fixes tag should be:
Fixes d342894c5d2f ("vxlan: virtual extensible lan")David, can you please re-submit with "[PATCH net]" prefix and the above tag?
I can take care of that. Thanks for analyzing the situation.
One thing i still have in my head when looking at this:
From my understanding, when i manage to send out such a packet from e.g. a VM connected to a vxlan overlay network and manage to send out such malformed packet, this would allow me to break the overlay network created with vxlan doesn't it?
Can you comment on my assumption there? I assume you have a better understanding of the inner workings of the vxlan protocol.
Best
David
Quoted 2 lines
Thanks
Quoted 9 lines · David Bauer
I can take care of that. Thanks for analyzing the situation.
One thing i still have in my head when looking at this:
From my understanding, when i manage to send out such a packet from e.g. a VM connected to a vxlan overlay network and manage to send out such malformed packet, this would allow me to break the overlay network created with vxlan doesn't it?
Can you comment on my assumption there?
I'm not sure which assumption you are referring to, but I did verify that before your patch the VXLAN driver will learn an FDB entry with a broadcast MAC if a malformed packet with a broadcast source MAC was processed by it. This will cause the driver to send broadcast packets to the VTEP that sent the malformed packet instead of flooding such packets to all the VTEPs via the all-zeroes FDB entry. This behavior is obviously wrong and I tested that it doesn't happen with your patch.