netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vxlan: Avoid creating fdb entry with NULL destination
@ 2013-09-17 19:12 Sridhar Samudrala
  2013-09-18  0:20 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Sridhar Samudrala @ 2013-09-17 19:12 UTC (permalink / raw)
  To: davem; +Cc: netdev, stephen, mike.rapoport

Commit afbd8bae9c798c5cdbe4439d3a50536b5438247c 
   vxlan: add implicit fdb entry for default destination
creates an implicit fdb entry for default destination. This results 
in an invalid fdb entry if default destination is not specified.
For ex: 
  ip link add vxlan1 type vxlan id 100
creates the following fdb entry
  00:00:00:00:00:00 dev vxlan1 dst 0.0.0.0 self permanent

This patch fixes this issue by creating an fdb entry only if a
valid default destination is specified.

Signed-off-by: Sridhar Samudrala <sri@us.ibm.com>
---

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index bf64b41..ac25c2d 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -2492,15 +2492,19 @@ static int vxlan_newlink(struct net *net, struct net_device *dev,
 
 	SET_ETHTOOL_OPS(dev, &vxlan_ethtool_ops);
 
-	/* create an fdb entry for default destination */
-	err = vxlan_fdb_create(vxlan, all_zeros_mac,
-			       &vxlan->default_dst.remote_ip,
-			       NUD_REACHABLE|NUD_PERMANENT,
-			       NLM_F_EXCL|NLM_F_CREATE,
-			       vxlan->dst_port, vxlan->default_dst.remote_vni,
-			       vxlan->default_dst.remote_ifindex, NTF_SELF);
-	if (err)
-		return err;
+	/* create an fdb entry for a valid default destination */
+	if (!vxlan_addr_any(&vxlan->default_dst.remote_ip)) {
+		err = vxlan_fdb_create(vxlan, all_zeros_mac,
+				       &vxlan->default_dst.remote_ip,
+				       NUD_REACHABLE|NUD_PERMANENT,
+				       NLM_F_EXCL|NLM_F_CREATE,
+				       vxlan->dst_port,
+				       vxlan->default_dst.remote_vni,
+				       vxlan->default_dst.remote_ifindex,
+				       NTF_SELF);
+		if (err)
+			return err;
+	}
 
 	err = register_netdevice(dev);
 	if (err) {

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

* Re: [PATCH] vxlan: Avoid creating fdb entry with NULL destination
  2013-09-17 19:12 [PATCH] vxlan: Avoid creating fdb entry with NULL destination Sridhar Samudrala
@ 2013-09-18  0:20 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2013-09-18  0:20 UTC (permalink / raw)
  To: sri; +Cc: netdev, stephen, mike.rapoport

From: Sridhar Samudrala <sri@us.ibm.com>
Date: Tue, 17 Sep 2013 12:12:40 -0700

> Commit afbd8bae9c798c5cdbe4439d3a50536b5438247c 
>    vxlan: add implicit fdb entry for default destination
> creates an implicit fdb entry for default destination. This results 
> in an invalid fdb entry if default destination is not specified.
> For ex: 
>   ip link add vxlan1 type vxlan id 100
> creates the following fdb entry
>   00:00:00:00:00:00 dev vxlan1 dst 0.0.0.0 self permanent
> 
> This patch fixes this issue by creating an fdb entry only if a
> valid default destination is specified.
> 
> Signed-off-by: Sridhar Samudrala <sri@us.ibm.com>

Looks reasonable, applied, thanks.

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

end of thread, other threads:[~2013-09-18  0:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-17 19:12 [PATCH] vxlan: Avoid creating fdb entry with NULL destination Sridhar Samudrala
2013-09-18  0:20 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).