netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v5 0/6] vxlan: allow specifying multiple default destinations
@ 2013-06-25 13:01 Mike Rapoport
  2013-06-25 13:01 ` [PATCH net-next v5 1/6] vxlan: add implicit fdb entry for default destination Mike Rapoport
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: Mike Rapoport @ 2013-06-25 13:01 UTC (permalink / raw)
  To: netdev
  Cc: Stephen Hemminger, David Stevens, Thomas Graf, Cong Wang,
	Mike Rapoport

These patches add ability to specify multiple default destinations to
vxlan. This ability is usefull in cases when multicast are disabled on
infrastructure level, for instance in public clouds.

The default destinations list is managed via the fdb entry with
"00:00:00:00:00:00" MAC address and does not require changes to vxlan
netlink API.

The default destinations can be added/deleted using 'bridge fdb'
commands, e.g:

# ip link add vxlan0 type vxlan id 23 group 239.1.1.1 dev eth0
# bridge fdb show dev vxlan0
00:00:00:00:00:00 dst 239.1.1.1 self permanent

# bridge fdb append 00:00:00:00:00:00 dev vxlan0 dst 54.242.49.246
# bridge fdb append 00:00:00:00:00:00 dev vxlan0 dst 23.22.26.34
# bridge fdb append 00:00:00:00:00:00 dev vxlan0 dst 184.72.129.120
# bridge fdb show dev vxlan0
00:00:00:00:00:00 dst 239.1.1.1 self permanent
00:00:00:00:00:00 dst 54.242.49.246 self permanent
00:00:00:00:00:00 dst 23.22.26.34 self permanent
00:00:00:00:00:00 dst 184.72.129.120 self permanent

# bridge fdb delete 00:00:00:00:00:00 dev vxlan0 dst 23.22.26.34
# bridge fdb append 00:00:00:00:00:00 dev vxlan0 dst 54.242.49.246
# bridge fdb show dev vxlan0
00:00:00:00:00:00 dst 239.1.1.1 self permanent
00:00:00:00:00:00 dst 184.72.129.120 self permanent

Since v5 is complete rework, I've dropped prevoius changelog as not relevant.

Mike Rapoport (6):
  vxlan: add implicit fdb entry for default destination
  vxlan: introduce vxlan_fdb_find_rdst
  vxlan: introduce vxlan_fdb_parse
  vxlan: allow removal of single destination from fdb entry
  rtnetlink: allow using zero MAC address in rtnl_fdb_{add,del}
  vxlan: fdb: allow specifying multiple destinations for zero MAC

 drivers/net/vxlan.c  | 219 +++++++++++++++++++++++++++++++++++++--------------
 net/core/rtnetlink.c |   8 --
 2 files changed, 159 insertions(+), 68 deletions(-)

-- 
1.8.1.5

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

* [PATCH net-next v5 1/6] vxlan: add implicit fdb entry for default destination
  2013-06-25 13:01 [PATCH net-next v5 0/6] vxlan: allow specifying multiple default destinations Mike Rapoport
@ 2013-06-25 13:01 ` Mike Rapoport
  2013-06-25 13:01 ` [PATCH net-next v5 2/6] vxlan: introduce vxlan_fdb_find_rdst Mike Rapoport
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Mike Rapoport @ 2013-06-25 13:01 UTC (permalink / raw)
  To: netdev
  Cc: Stephen Hemminger, David Stevens, Thomas Graf, Cong Wang,
	Mike Rapoport

Signed-off-by: Mike Rapoport <mike.rapoport@ravellosystems.com>
---
 drivers/net/vxlan.c | 68 ++++++++++++++++++++++++++++++++++++++---------------
 1 file changed, 49 insertions(+), 19 deletions(-)

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 212a256..bdfe46e 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -80,6 +80,8 @@ MODULE_PARM_DESC(log_ecn_error, "Log packets received with corrupted ECN");
 
 static int vxlan_net_id;
 
+static const u8 all_zeros_mac[ETH_ALEN];
+
 /* per UDP socket information */
 struct vxlan_sock {
 	struct hlist_node hlist;
@@ -1151,7 +1153,7 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
 	struct vxlan_dev *vxlan = netdev_priv(dev);
 	struct ethhdr *eth;
 	bool did_rsc = false;
-	struct vxlan_rdst *rdst0, *rdst;
+	struct vxlan_rdst *rdst;
 	struct vxlan_fdb *f;
 
 	skb_reset_mac_header(skb);
@@ -1171,26 +1173,27 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
 	}
 
 	if (f == NULL) {
-		rdst0 = &vxlan->default_dst;
-
-		if (rdst0->remote_ip == htonl(INADDR_ANY) &&
-		    (vxlan->flags & VXLAN_F_L2MISS) &&
-		    !is_multicast_ether_addr(eth->h_dest))
-			vxlan_fdb_miss(vxlan, eth->h_dest);
-	} else {
-		rdst = rdst0 = first_remote(f);
+		f = vxlan_find_mac(vxlan, all_zeros_mac);
+		if (f == NULL) {
+			if ((vxlan->flags & VXLAN_F_L2MISS) &&
+			    !is_multicast_ether_addr(eth->h_dest))
+				vxlan_fdb_miss(vxlan, eth->h_dest);
+
+			dev->stats.tx_dropped++;
+			dev_kfree_skb(skb);
+			return NETDEV_TX_OK;
+		}
+	}
 
-		/* if there are multiple destinations, send copies */
-		list_for_each_entry_continue_rcu(rdst, &f->remotes, list) {
-			struct sk_buff *skb1;
+	list_for_each_entry_rcu(rdst, &f->remotes, list) {
+		struct sk_buff *skb1;
 
-			skb1 = skb_clone(skb, GFP_ATOMIC);
-			if (skb1)
-				vxlan_xmit_one(skb1, dev, rdst, did_rsc);
-		}
+		skb1 = skb_clone(skb, GFP_ATOMIC);
+		if (skb1)
+			vxlan_xmit_one(skb1, dev, rdst, did_rsc);
 	}
 
-	vxlan_xmit_one(skb, dev, rdst0, did_rsc);
+	dev_kfree_skb(skb);
 	return NETDEV_TX_OK;
 }
 
@@ -1260,12 +1263,25 @@ static int vxlan_init(struct net_device *dev)
 	return 0;
 }
 
+static void vxlan_fdb_delete_defualt(struct vxlan_dev *vxlan)
+{
+	struct vxlan_fdb *f;
+
+	spin_lock_bh(&vxlan->hash_lock);
+	f = __vxlan_find_mac(vxlan, all_zeros_mac);
+	if (f)
+		vxlan_fdb_destroy(vxlan, f);
+	spin_unlock_bh(&vxlan->hash_lock);
+}
+
 static void vxlan_uninit(struct net_device *dev)
 {
 	struct vxlan_dev *vxlan = netdev_priv(dev);
 	struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id);
 	struct vxlan_sock *vs = vxlan->vn_sock;
 
+	vxlan_fdb_delete_defualt(vxlan);
+
 	if (vs)
 		vxlan_sock_release(vn, vs);
 	free_percpu(dev->tstats);
@@ -1304,7 +1320,9 @@ static void vxlan_flush(struct vxlan_dev *vxlan)
 		hlist_for_each_safe(p, n, &vxlan->fdb_head[h]) {
 			struct vxlan_fdb *f
 				= container_of(p, struct vxlan_fdb, hlist);
-			vxlan_fdb_destroy(vxlan, f);
+			/* the all_zeros_mac entry is deleted at vxlan_uninit */
+			if (!is_zero_ether_addr(f->eth_addr))
+				vxlan_fdb_destroy(vxlan, f);
 		}
 	}
 	spin_unlock_bh(&vxlan->hash_lock);
@@ -1657,10 +1675,22 @@ static int vxlan_newlink(struct net *net, struct net_device *dev,
 
 	SET_ETHTOOL_OPS(dev, &vxlan_ethtool_ops);
 
-	err = register_netdevice(dev);
+	/* 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;
 
+	err = register_netdevice(dev);
+	if (err) {
+		vxlan_fdb_delete_defualt(vxlan);
+		return err;
+	}
+
 	list_add(&vxlan->next, &vn->vxlan_list);
 
 	return 0;
-- 
1.8.1.5

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

* [PATCH net-next v5 2/6] vxlan: introduce vxlan_fdb_find_rdst
  2013-06-25 13:01 [PATCH net-next v5 0/6] vxlan: allow specifying multiple default destinations Mike Rapoport
  2013-06-25 13:01 ` [PATCH net-next v5 1/6] vxlan: add implicit fdb entry for default destination Mike Rapoport
@ 2013-06-25 13:01 ` Mike Rapoport
  2013-06-25 13:01 ` [PATCH net-next v5 3/6] vxlan: introduce vxlan_fdb_parse Mike Rapoport
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Mike Rapoport @ 2013-06-25 13:01 UTC (permalink / raw)
  To: netdev
  Cc: Stephen Hemminger, David Stevens, Thomas Graf, Cong Wang,
	Mike Rapoport

which will be reused by vxlan_fdb_delete

Signed-off-by: Mike Rapoport <mike.rapoport@ravellosystems.com>
---
 drivers/net/vxlan.c | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index bdfe46e..306bd94 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -388,21 +388,34 @@ static struct vxlan_fdb *vxlan_find_mac(struct vxlan_dev *vxlan,
 	return f;
 }
 
-/* Add/update destinations for multicast */
-static int vxlan_fdb_append(struct vxlan_fdb *f,
-			    __be32 ip, __be16 port, __u32 vni, __u32 ifindex)
+/* caller should hold vxlan->hash_lock */
+static struct vxlan_rdst *vxlan_fdb_find_rdst(struct vxlan_fdb *f,
+					      __be32 ip, __be16 port,
+					      __u32 vni, __u32 ifindex)
 {
 	struct vxlan_rdst *rd;
 
-	/* protected by vxlan->hash_lock */
 	list_for_each_entry(rd, &f->remotes, list) {
 		if (rd->remote_ip == ip &&
 		    rd->remote_port == port &&
 		    rd->remote_vni == vni &&
 		    rd->remote_ifindex == ifindex)
-			return 0;
+			return rd;
 	}
 
+	return NULL;
+}
+
+/* Add/update destinations for multicast */
+static int vxlan_fdb_append(struct vxlan_fdb *f,
+			    __be32 ip, __be16 port, __u32 vni, __u32 ifindex)
+{
+	struct vxlan_rdst *rd;
+
+	rd = vxlan_fdb_find_rdst(f, ip, port, vni, ifindex);
+	if (rd)
+		return 0;
+
 	rd = kmalloc(sizeof(*rd), GFP_ATOMIC);
 	if (rd == NULL)
 		return -ENOBUFS;
-- 
1.8.1.5

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

* [PATCH net-next v5 3/6] vxlan: introduce vxlan_fdb_parse
  2013-06-25 13:01 [PATCH net-next v5 0/6] vxlan: allow specifying multiple default destinations Mike Rapoport
  2013-06-25 13:01 ` [PATCH net-next v5 1/6] vxlan: add implicit fdb entry for default destination Mike Rapoport
  2013-06-25 13:01 ` [PATCH net-next v5 2/6] vxlan: introduce vxlan_fdb_find_rdst Mike Rapoport
@ 2013-06-25 13:01 ` Mike Rapoport
  2013-06-25 13:01 ` [PATCH net-next v5 4/6] vxlan: allow removal of single destination from fdb entry Mike Rapoport
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Mike Rapoport @ 2013-06-25 13:01 UTC (permalink / raw)
  To: netdev
  Cc: Stephen Hemminger, David Stevens, Thomas Graf, Cong Wang,
	Mike Rapoport

which will be reused by vxlan_fdb_delete

Signed-off-by: Mike Rapoport <mike.rapoport@ravellosystems.com>
---
 drivers/net/vxlan.c | 81 +++++++++++++++++++++++++++++++++--------------------
 1 file changed, 50 insertions(+), 31 deletions(-)

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 306bd94..ee7cc71 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -518,58 +518,77 @@ static void vxlan_fdb_destroy(struct vxlan_dev *vxlan, struct vxlan_fdb *f)
 	call_rcu(&f->rcu, vxlan_fdb_free);
 }
 
-/* Add static entry (via netlink) */
-static int vxlan_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
-			 struct net_device *dev,
-			 const unsigned char *addr, u16 flags)
+static int vxlan_fdb_parse(struct nlattr *tb[], struct vxlan_dev *vxlan,
+			   __be32 *ip, __be16 *port, u32 *vni, u32 *ifindex)
 {
-	struct vxlan_dev *vxlan = netdev_priv(dev);
 	struct net *net = dev_net(vxlan->dev);
-	__be32 ip;
-	__be16 port;
-	u32 vni, ifindex;
-	int err;
-
-	if (!(ndm->ndm_state & (NUD_PERMANENT|NUD_REACHABLE))) {
-		pr_info("RTM_NEWNEIGH with invalid state %#x\n",
-			ndm->ndm_state);
-		return -EINVAL;
-	}
-
-	if (tb[NDA_DST] == NULL)
-		return -EINVAL;
 
-	if (nla_len(tb[NDA_DST]) != sizeof(__be32))
-		return -EAFNOSUPPORT;
+	if (tb[NDA_DST]) {
+		if (nla_len(tb[NDA_DST]) != sizeof(__be32))
+			return -EAFNOSUPPORT;
 
-	ip = nla_get_be32(tb[NDA_DST]);
+		*ip = nla_get_be32(tb[NDA_DST]);
+	} else {
+		*ip = htonl(INADDR_ANY);
+	}
 
 	if (tb[NDA_PORT]) {
 		if (nla_len(tb[NDA_PORT]) != sizeof(__be16))
 			return -EINVAL;
-		port = nla_get_be16(tb[NDA_PORT]);
-	} else
-		port = vxlan->dst_port;
+		*port = nla_get_be16(tb[NDA_PORT]);
+	} else {
+		*port = vxlan->dst_port;
+	}
 
 	if (tb[NDA_VNI]) {
 		if (nla_len(tb[NDA_VNI]) != sizeof(u32))
 			return -EINVAL;
-		vni = nla_get_u32(tb[NDA_VNI]);
-	} else
-		vni = vxlan->default_dst.remote_vni;
+		*vni = nla_get_u32(tb[NDA_VNI]);
+	} else {
+		*vni = vxlan->default_dst.remote_vni;
+	}
 
 	if (tb[NDA_IFINDEX]) {
 		struct net_device *tdev;
 
 		if (nla_len(tb[NDA_IFINDEX]) != sizeof(u32))
 			return -EINVAL;
-		ifindex = nla_get_u32(tb[NDA_IFINDEX]);
-		tdev = dev_get_by_index(net, ifindex);
+		*ifindex = nla_get_u32(tb[NDA_IFINDEX]);
+		tdev = dev_get_by_index(net, *ifindex);
 		if (!tdev)
 			return -EADDRNOTAVAIL;
 		dev_put(tdev);
-	} else
-		ifindex = 0;
+	} else {
+		*ifindex = 0;
+	}
+
+	return 0;
+}
+
+/* Add static entry (via netlink) */
+static int vxlan_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
+			 struct net_device *dev,
+			 const unsigned char *addr, u16 flags)
+{
+	struct vxlan_dev *vxlan = netdev_priv(dev);
+	/* struct net *net = dev_net(vxlan->dev); */
+	__be32 ip;
+	__be16 port;
+	u32 vni, ifindex;
+	int err;
+
+	if (!(ndm->ndm_state & (NUD_PERMANENT|NUD_REACHABLE))) {
+		pr_info("RTM_NEWNEIGH with invalid state %#x\n",
+			ndm->ndm_state);
+		return -EINVAL;
+	}
+
+	if (tb[NDA_DST] == NULL)
+		return -EINVAL;
+
+	err = vxlan_fdb_parse(tb, vxlan, &ip, &port, &vni, &ifindex);
+	if (err)
+		return err;
 
 	spin_lock_bh(&vxlan->hash_lock);
 	err = vxlan_fdb_create(vxlan, addr, ip, ndm->ndm_state, flags,
-- 
1.8.1.5

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

* [PATCH net-next v5 4/6] vxlan: allow removal of single destination from fdb entry
  2013-06-25 13:01 [PATCH net-next v5 0/6] vxlan: allow specifying multiple default destinations Mike Rapoport
                   ` (2 preceding siblings ...)
  2013-06-25 13:01 ` [PATCH net-next v5 3/6] vxlan: introduce vxlan_fdb_parse Mike Rapoport
@ 2013-06-25 13:01 ` Mike Rapoport
  2013-06-25 13:01 ` [PATCH net-next v5 5/6] rtnetlink: allow using zero MAC address in rtnl_fdb_{add,del} Mike Rapoport
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Mike Rapoport @ 2013-06-25 13:01 UTC (permalink / raw)
  To: netdev
  Cc: Stephen Hemminger, David Stevens, Thomas Graf, Cong Wang,
	Mike Rapoport

When the last item is deleted from the remote destinations list, the
fdb entry is destroyed.

Signed-off-by: Mike Rapoport <mike.rapoport@ravellosystems.com>
---
 drivers/net/vxlan.c | 44 ++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 40 insertions(+), 4 deletions(-)

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index ee7cc71..c182520 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -105,6 +105,7 @@ struct vxlan_rdst {
 	u32			 remote_vni;
 	u32			 remote_ifindex;
 	struct list_head	 list;
+	struct rcu_head		 rcu;
 };
 
 /* Forwarding table entry */
@@ -496,6 +497,12 @@ static int vxlan_fdb_create(struct vxlan_dev *vxlan,
 	return 0;
 }
 
+static void vxlan_fdb_free_rdst(struct rcu_head *head)
+{
+	struct vxlan_rdst *rd = container_of(head, struct vxlan_rdst, rcu);
+	kfree(rd);
+}
+
 static void vxlan_fdb_free(struct rcu_head *head)
 {
 	struct vxlan_fdb *f = container_of(head, struct vxlan_fdb, rcu);
@@ -605,14 +612,43 @@ static int vxlan_fdb_delete(struct ndmsg *ndm, struct nlattr *tb[],
 {
 	struct vxlan_dev *vxlan = netdev_priv(dev);
 	struct vxlan_fdb *f;
-	int err = -ENOENT;
+	struct vxlan_rdst *rd = NULL;
+	__be32 ip;
+	__be16 port;
+	u32 vni, ifindex;
+	int err;
+
+	err = vxlan_fdb_parse(tb, vxlan, &ip, &port, &vni, &ifindex);
+	if (err)
+		return err;
+
+	err = -ENOENT;
 
 	spin_lock_bh(&vxlan->hash_lock);
 	f = vxlan_find_mac(vxlan, addr);
-	if (f) {
-		vxlan_fdb_destroy(vxlan, f);
-		err = 0;
+	if (!f)
+		goto out;
+
+	if (ip != htonl(INADDR_ANY)) {
+		rd = vxlan_fdb_find_rdst(f, ip, port, vni, ifindex);
+		if (!rd)
+			goto out;
+	}
+
+	err = 0;
+
+	/* remove a destination if it's not the only one on the list,
+	 * otherwise destroy the fdb entry
+	 */
+	if (rd && !list_is_singular(&f->remotes)) {
+		list_del_rcu(&rd->list);
+		call_rcu(&rd->rcu, vxlan_fdb_free_rdst);
+		goto out;
 	}
+
+	vxlan_fdb_destroy(vxlan, f);
+
+out:
 	spin_unlock_bh(&vxlan->hash_lock);
 
 	return err;
-- 
1.8.1.5

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

* [PATCH net-next v5 5/6] rtnetlink: allow using zero MAC address in rtnl_fdb_{add,del}
  2013-06-25 13:01 [PATCH net-next v5 0/6] vxlan: allow specifying multiple default destinations Mike Rapoport
                   ` (3 preceding siblings ...)
  2013-06-25 13:01 ` [PATCH net-next v5 4/6] vxlan: allow removal of single destination from fdb entry Mike Rapoport
@ 2013-06-25 13:01 ` Mike Rapoport
  2013-06-25 16:37   ` Stephen Hemminger
  2013-06-25 13:01 ` [PATCH net-next v5 6/6] vxlan: fdb: allow specifying multiple destinations for zero MAC Mike Rapoport
  2013-06-25 21:19 ` [PATCH net-next v5 0/6] vxlan: allow specifying multiple default destinations Stephen Hemminger
  6 siblings, 1 reply; 10+ messages in thread
From: Mike Rapoport @ 2013-06-25 13:01 UTC (permalink / raw)
  To: netdev
  Cc: Stephen Hemminger, David Stevens, Thomas Graf, Cong Wang,
	Mike Rapoport

This is required for multiple default destinations management in VXLAN

Signed-off-by: Mike Rapoport <mike.rapoport@ravellosystems.com>
---
 net/core/rtnetlink.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 9007533..3de7408 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -2109,10 +2109,6 @@ static int rtnl_fdb_add(struct sk_buff *skb, struct nlmsghdr *nlh)
 	}
 
 	addr = nla_data(tb[NDA_LLADDR]);
-	if (is_zero_ether_addr(addr)) {
-		pr_info("PF_BRIDGE: RTM_NEWNEIGH with invalid ether address\n");
-		return -EINVAL;
-	}
 
 	err = -EOPNOTSUPP;
 
@@ -2210,10 +2206,6 @@ static int rtnl_fdb_del(struct sk_buff *skb, struct nlmsghdr *nlh)
 	}
 
 	addr = nla_data(tb[NDA_LLADDR]);
-	if (is_zero_ether_addr(addr)) {
-		pr_info("PF_BRIDGE: RTM_DELNEIGH with invalid ether address\n");
-		return -EINVAL;
-	}
 
 	err = -EOPNOTSUPP;
 
-- 
1.8.1.5

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

* [PATCH net-next v5 6/6] vxlan: fdb: allow specifying multiple destinations for zero MAC
  2013-06-25 13:01 [PATCH net-next v5 0/6] vxlan: allow specifying multiple default destinations Mike Rapoport
                   ` (4 preceding siblings ...)
  2013-06-25 13:01 ` [PATCH net-next v5 5/6] rtnetlink: allow using zero MAC address in rtnl_fdb_{add,del} Mike Rapoport
@ 2013-06-25 13:01 ` Mike Rapoport
  2013-06-25 21:19 ` [PATCH net-next v5 0/6] vxlan: allow specifying multiple default destinations Stephen Hemminger
  6 siblings, 0 replies; 10+ messages in thread
From: Mike Rapoport @ 2013-06-25 13:01 UTC (permalink / raw)
  To: netdev
  Cc: Stephen Hemminger, David Stevens, Thomas Graf, Cong Wang,
	Mike Rapoport

The zero MAC entry in the fdb is used as default destination. With
multiple default destinations it is possible to use vxlan in
environments that disable multicast on the infrastructure level, e.g.
public clouds.

Signed-off-by: Mike Rapoport <mike.rapoport@ravellosystems.com>
---
 drivers/net/vxlan.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index c182520..3e75f97 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -458,7 +458,8 @@ static int vxlan_fdb_create(struct vxlan_dev *vxlan,
 			notify = 1;
 		}
 		if ((flags & NLM_F_APPEND) &&
-		    is_multicast_ether_addr(f->eth_addr)) {
+		    (is_multicast_ether_addr(f->eth_addr) ||
+		     is_zero_ether_addr(f->eth_addr))) {
 			int rc = vxlan_fdb_append(f, ip, port, vni, ifindex);
 
 			if (rc < 0)
-- 
1.8.1.5

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

* Re: [PATCH net-next v5 5/6] rtnetlink: allow using zero MAC address in rtnl_fdb_{add,del}
  2013-06-25 13:01 ` [PATCH net-next v5 5/6] rtnetlink: allow using zero MAC address in rtnl_fdb_{add,del} Mike Rapoport
@ 2013-06-25 16:37   ` Stephen Hemminger
  2013-06-25 23:48     ` David Miller
  0 siblings, 1 reply; 10+ messages in thread
From: Stephen Hemminger @ 2013-06-25 16:37 UTC (permalink / raw)
  To: Mike Rapoport; +Cc: netdev, David Stevens, Thomas Graf, Cong Wang

This is needed, to avoid breaking bridge use of fdb.
I will just add it after Mike's patches.


>From 9d1cdde78c5973eeb0c80b5b053ea35e61005253 Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <stephen@networkplumber.org>
Date: Tue, 25 Jun 2013 09:34:36 -0700
Subject: [PATCH] bridge: check for zero ether address in fdb add

The check for all-zero ether address was removed from rtnetlink core,
since Vxlan uses all-zero ether address to signify default address.
Need to add check back in for bridge.

Signed-off-by: Stephen Hemminber <stephen@networkplumber.org>
---
 net/bridge/br_fdb.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
index ebfa444..60aca91 100644
--- a/net/bridge/br_fdb.c
+++ b/net/bridge/br_fdb.c
@@ -707,6 +707,11 @@ int br_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
 		}
 	}
 
+	if (is_zero_ether_addr(addr)) {
+		pr_info("bridge: RTM_NEWNEIGH with invalid ether address\n");
+		return -EINVAL;
+	}
+
 	p = br_port_get_rtnl(dev);
 	if (p == NULL) {
 		pr_info("bridge: RTM_NEWNEIGH %s not a bridge port\n",
-- 
1.7.10.4

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

* Re: [PATCH net-next v5 0/6] vxlan: allow specifying multiple default destinations
  2013-06-25 13:01 [PATCH net-next v5 0/6] vxlan: allow specifying multiple default destinations Mike Rapoport
                   ` (5 preceding siblings ...)
  2013-06-25 13:01 ` [PATCH net-next v5 6/6] vxlan: fdb: allow specifying multiple destinations for zero MAC Mike Rapoport
@ 2013-06-25 21:19 ` Stephen Hemminger
  6 siblings, 0 replies; 10+ messages in thread
From: Stephen Hemminger @ 2013-06-25 21:19 UTC (permalink / raw)
  To: Mike Rapoport; +Cc: netdev, David Stevens, Thomas Graf, Cong Wang

On Tue, 25 Jun 2013 16:01:50 +0300
Mike Rapoport <mike.rapoport@ravellosystems.com> wrote:

> These patches add ability to specify multiple default destinations to
> vxlan. This ability is usefull in cases when multicast are disabled on
> infrastructure level, for instance in public clouds.
> 
> The default destinations list is managed via the fdb entry with
> "00:00:00:00:00:00" MAC address and does not require changes to vxlan
> netlink API.
> 
> The default destinations can be added/deleted using 'bridge fdb'
> commands, e.g:
> 
> # ip link add vxlan0 type vxlan id 23 group 239.1.1.1 dev eth0
> # bridge fdb show dev vxlan0
> 00:00:00:00:00:00 dst 239.1.1.1 self permanent
> 
> # bridge fdb append 00:00:00:00:00:00 dev vxlan0 dst 54.242.49.246
> # bridge fdb append 00:00:00:00:00:00 dev vxlan0 dst 23.22.26.34
> # bridge fdb append 00:00:00:00:00:00 dev vxlan0 dst 184.72.129.120
> # bridge fdb show dev vxlan0
> 00:00:00:00:00:00 dst 239.1.1.1 self permanent
> 00:00:00:00:00:00 dst 54.242.49.246 self permanent
> 00:00:00:00:00:00 dst 23.22.26.34 self permanent
> 00:00:00:00:00:00 dst 184.72.129.120 self permanent
> 
> # bridge fdb delete 00:00:00:00:00:00 dev vxlan0 dst 23.22.26.34
> # bridge fdb append 00:00:00:00:00:00 dev vxlan0 dst 54.242.49.246
> # bridge fdb show dev vxlan0
> 00:00:00:00:00:00 dst 239.1.1.1 self permanent
> 00:00:00:00:00:00 dst 184.72.129.120 self permanent
> 
> Since v5 is complete rework, I've dropped prevoius changelog as not relevant.
> 
I assume iproute changes are no longer needed?


It would be good to have multiple non-default destinations as well.
It would allow for implementing multicast MAC addresses.

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

* Re: [PATCH net-next v5 5/6] rtnetlink: allow using zero MAC address in rtnl_fdb_{add,del}
  2013-06-25 16:37   ` Stephen Hemminger
@ 2013-06-25 23:48     ` David Miller
  0 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2013-06-25 23:48 UTC (permalink / raw)
  To: stephen; +Cc: mike.rapoport, netdev, dlstevens, tgraf, xiyou.wangcong

From: Stephen Hemminger <stephen@networkplumber.org>
Date: Tue, 25 Jun 2013 09:37:38 -0700

> This is needed, to avoid breaking bridge use of fdb.
> I will just add it after Mike's patches.

Ok, then I expect this series via a pull request from you Stephen.

Thanks.

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

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

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-25 13:01 [PATCH net-next v5 0/6] vxlan: allow specifying multiple default destinations Mike Rapoport
2013-06-25 13:01 ` [PATCH net-next v5 1/6] vxlan: add implicit fdb entry for default destination Mike Rapoport
2013-06-25 13:01 ` [PATCH net-next v5 2/6] vxlan: introduce vxlan_fdb_find_rdst Mike Rapoport
2013-06-25 13:01 ` [PATCH net-next v5 3/6] vxlan: introduce vxlan_fdb_parse Mike Rapoport
2013-06-25 13:01 ` [PATCH net-next v5 4/6] vxlan: allow removal of single destination from fdb entry Mike Rapoport
2013-06-25 13:01 ` [PATCH net-next v5 5/6] rtnetlink: allow using zero MAC address in rtnl_fdb_{add,del} Mike Rapoport
2013-06-25 16:37   ` Stephen Hemminger
2013-06-25 23:48     ` David Miller
2013-06-25 13:01 ` [PATCH net-next v5 6/6] vxlan: fdb: allow specifying multiple destinations for zero MAC Mike Rapoport
2013-06-25 21:19 ` [PATCH net-next v5 0/6] vxlan: allow specifying multiple default destinations Stephen Hemminger

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).