From: Stephen Hemminger <stephen@networkplumber.org>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH net v2 01/03] vxlan: only migrate dynamic FDB entries
Date: Mon, 10 Jun 2013 13:13:17 -0700 [thread overview]
Message-ID: <20130610131317.0c17ed0d@nehalam.linuxnetplumber.net> (raw)
In-Reply-To: <20130610195822.888424947@vyatta.com>
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.
--- a/drivers/net/vxlan.c 2013-06-06 08:27:07.499595174 -0700
+++ b/drivers/net/vxlan.c 2013-06-06 09:38:54.291654035 -0700
@@ -603,9 +603,10 @@ skip:
/* Watch incoming packets to learn mapping between Ethernet address
* and Tunnel endpoint.
+ * Return true if packet is bogus and should be droppped.
*/
-static void vxlan_snoop(struct net_device *dev,
- __be32 src_ip, const u8 *src_mac)
+static bool 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 +615,11 @@ static void vxlan_snoop(struct net_devic
f = vxlan_find_mac(vxlan, src_mac);
if (likely(f)) {
if (likely(f->remote.remote_ip == src_ip))
- return;
+ return false;
+
+ /* Don't migrate static entries, drop packets */
+ if (!(f->flags & NTF_SELF))
+ return true;
if (net_ratelimit())
netdev_info(dev,
@@ -634,6 +639,8 @@ static void vxlan_snoop(struct net_devic
0, NTF_SELF);
spin_unlock(&vxlan->hash_lock);
}
+
+ return false;
}
@@ -766,8 +773,9 @@ static int vxlan_udp_encap_recv(struct s
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);
next prev parent reply other threads:[~2013-06-10 20:13 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20130610195822.888424947@vyatta.com>
2013-06-10 20:12 ` [PATCH net v2 02/03] vxlan: handle skb_clone failure Stephen Hemminger
2013-06-10 21:01 ` David Miller
2013-06-10 20:13 ` [PATCH net v2 03/03] [PATCH] vxlan: fix crash on module removal Stephen Hemminger
2013-06-10 21:01 ` David Miller
2013-06-10 21:14 ` David Miller
2013-06-10 21:18 ` David Miller
2013-06-10 21:48 ` Stephen Hemminger
2013-06-11 4:10 ` David Miller
2013-06-10 20:13 ` Stephen Hemminger [this message]
2013-06-10 20:27 ` [PATCH net v2 01/03] vxlan: only migrate dynamic FDB entries Sergei Shtylyov
2013-06-10 20:32 ` Stephen Hemminger
2013-06-10 20:42 ` David Miller
2013-06-10 21:00 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130610131317.0c17ed0d@nehalam.linuxnetplumber.net \
--to=stephen@networkplumber.org \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.