All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 01/10] vxlan: only migrate dynamic FDB entries
@ 2013-06-05  4:24 Stephen Hemminger
  2013-06-05  4:24 ` [PATCH net-next 02/10] vxlan: handle skb_clone failure Stephen Hemminger
                   ` (10 more replies)
  0 siblings, 11 replies; 30+ messages in thread
From: Stephen Hemminger @ 2013-06-05  4:24 UTC (permalink / raw)
  To: davem; +Cc: netdev, Stephen Hemminger

Only migrate dynamic forwarding table entries, don't modify
static entries. If packet received from incorrect source IP address
assume it is an imposter and drop it.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

---
Should go to -stable as well.
---
 drivers/net/vxlan.c |   17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 8111565..536082a 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -604,8 +604,8 @@ skip:
 /* Watch incoming packets to learn mapping between Ethernet address
  * and Tunnel endpoint.
  */
-static void vxlan_snoop(struct net_device *dev,
-			__be32 src_ip, const u8 *src_mac)
+static int vxlan_snoop(struct net_device *dev,
+		       __be32 src_ip, const u8 *src_mac)
 {
 	struct vxlan_dev *vxlan = netdev_priv(dev);
 	struct vxlan_fdb *f;
@@ -614,7 +614,11 @@ static void vxlan_snoop(struct net_device *dev,
 	f = vxlan_find_mac(vxlan, src_mac);
 	if (likely(f)) {
 		if (likely(f->remote.remote_ip == src_ip))
-			return;
+			return 0;
+
+		/* Don't migrate static entries, drop packets */
+		if (!(f->flags & NTF_SELF))
+			return 1;
 
 		if (net_ratelimit())
 			netdev_info(dev,
@@ -634,6 +638,8 @@ static void vxlan_snoop(struct net_device *dev,
 				       0, NTF_SELF);
 		spin_unlock(&vxlan->hash_lock);
 	}
+
+	return 0;
 }
 
 
@@ -766,8 +772,9 @@ static int vxlan_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
 			       vxlan->dev->dev_addr) == 0)
 		goto drop;
 
-	if (vxlan->flags & VXLAN_F_LEARN)
-		vxlan_snoop(skb->dev, oip->saddr, eth_hdr(skb)->h_source);
+	if ((vxlan->flags & VXLAN_F_LEARN) &&
+	    vxlan_snoop(skb->dev, oip->saddr, eth_hdr(skb)->h_source))
+		goto drop;
 
 	__skb_tunnel_rx(skb, vxlan->dev);
 	skb_reset_network_header(skb);
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2013-06-08  8:23 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-05  4:24 [PATCH net-next 01/10] vxlan: only migrate dynamic FDB entries Stephen Hemminger
2013-06-05  4:24 ` [PATCH net-next 02/10] vxlan: handle skb_clone failure Stephen Hemminger
2013-06-05  6:59   ` Cong Wang
2013-06-05 14:05     ` David Stevens
2013-06-06  0:47       ` Cong Wang
2013-06-06  1:31         ` Stephen Hemminger
2013-06-05 12:50   ` David Stevens
2013-06-05  4:24 ` [PATCH net-next 03/10] vxlan: move IGMP join/leave to work queue Stephen Hemminger
2013-06-05  6:47   ` Cong Wang
2013-06-05  7:29     ` Mike Rapoport
2013-06-05  8:00       ` Cong Wang
2013-06-05 15:41       ` Stephen Hemminger
2013-06-08  8:23         ` Mike Rapoport
2013-06-05 15:42     ` Stephen Hemminger
2013-06-06  0:49       ` Cong Wang
2013-06-05 15:37   ` [PATCH net] vxlan: fix crash on module removal Stephen Hemminger
2013-06-06  1:11     ` Cong Wang
2013-06-06  1:32       ` Stephen Hemminger
2013-06-05  4:24 ` [PATCH net-next 04/10] vxlan: send notification when MAC migrates Stephen Hemminger
2013-06-05  4:24 ` [PATCH net-next 05/10] vxlan: make vxlan_xmit_one void Stephen Hemminger
2013-06-05 12:54   ` David Stevens
2013-06-05  4:24 ` [PATCH net-next 06/10] vxlan: convert remotes list to list_rcu Stephen Hemminger
2013-06-05  4:24 ` [PATCH net-next 07/10] vxlan: port module param should be ushort Stephen Hemminger
2013-06-05 13:35   ` Sergei Shtylyov
2013-06-05  4:24 ` [PATCH net-next 08/10] vxlan: use initializer for dummy structures Stephen Hemminger
2013-06-05  4:24 ` [PATCH net-next 09/10] vxlan: whitespace cleanup Stephen Hemminger
2013-06-05 12:55   ` David Stevens
2013-06-05  4:24 ` [PATCH net-next 10/10] vxlan: version 0.2 Stephen Hemminger
2013-06-05  6:23 ` [PATCH net-next 01/10] vxlan: only migrate dynamic FDB entries Cong Wang
2013-06-06 23:16 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.