Skip to contentSkip to conversation

vxlan: Allow setting unicast address to the group address

PATCH In review Atzm Watanabe 2 participants 3 messages Apr 10, 2013 – Apr 11, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vxlan: Allow setting unicast address to the group address

This patch allows setting unicast address to the VXLAN group address. It allows that VXLAN can be used as peer-to-peer tunnel without multicast.

---
 drivers/net/vxlan.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)
drivers/net/vxlan.c +3 -11
index 9a64715..9e105f9 100644
@@ -106,7 +106,7 @@ struct vxlan_dev {
 	struct hlist_node hlist;
 	struct net_device *dev;
 	__u32		  vni;		/* virtual network id */
-	__be32	          gaddr;	/* multicast group */
+	__be32	          gaddr;	/* group address */
 	__be32		  saddr;	/* source address */
 	unsigned int      link;		/* link to multicast over */
 	__u16		  port_min;	/* source port range */
@@ -1189,7 +1189,7 @@ static int vxlan_open(struct net_device *dev)
 	struct vxlan_dev *vxlan = netdev_priv(dev);
 	int err;
 
-	if (vxlan->gaddr) {
+	if (IN_MULTICAST(ntohl(vxlan->gaddr))) {
 		err = vxlan_join_group(dev);
 		if (err)
 			return err;
@@ -1223,7 +1223,7 @@ static int vxlan_stop(struct net_device *dev)
 {
 	struct vxlan_dev *vxlan = netdev_priv(dev);
 
-	if (vxlan->gaddr)
+	if (IN_MULTICAST(ntohl(vxlan->gaddr)))
 		vxlan_leave_group(dev);
 
 	del_timer_sync(&vxlan->age_timer);
@@ -1347,14 +1347,6 @@ static int vxlan_validate(struct nlattr *tb[], struct nlattr *data[])
 			return -ERANGE;
 	}
 
-	if (data[IFLA_VXLAN_GROUP]) {
-		__be32 gaddr = nla_get_be32(data[IFLA_VXLAN_GROUP]);
-		if (!IN_MULTICAST(ntohl(gaddr))) {
-			pr_debug("group address is not IPv4 multicast\n");
-			return -EADDRNOTAVAIL;
-		}
-	}
-
 	if (data[IFLA_VXLAN_PORT_RANGE]) {
 		const struct ifla_vxlan_port_range *p
 			= nla_data(data[IFLA_VXLAN_PORT_RANGE]);
Signature · 1 line
1.8.1.5
#1 lore raw
Quoted 4 lines · Atzm Watanabe

This patch allows setting unicast address to the VXLAN group address. It allows that VXLAN can be used as peer-to-peer tunnel without multicast.

Then GROUP is confusing, please pick another name and attribute.

Thanks.

#2 lore raw

At Thu, 11 Apr 2013 04:05:01 +0000 (UTC),

Quoted 8 lines · Cong Wang
Quoted 4 lines · Atzm Watanabe

This patch allows setting unicast address to the VXLAN group address. It allows that VXLAN can be used as peer-to-peer tunnel without multicast.

Then GROUP is confusing, please pick another name and attribute.

OK, I agreed.

But simply adding another name and attribute also means that a VXLAN interface can have multiple "last resort".
So I'll try to fix as below:

1) Replace "gaddr" by "daddr", in struct vxlan_dev.
2) Add IFLA_VXLAN_REMOTE apart from IFLA_VXLAN_GROUP.
3) If IFLA_VXLAN_REMOTE and IFLA_VXLAN_GROUP are specified at a time, vxlan_validate() will return an error.

If you have other better ideas, please let me know.

Thanks.