Patchwork [iproute2,v5] vxlan: Allow setting destination to unicast address.

login
register
mail settings
Submitter Atzm Watanabe
Date July 17, 2013, 9:40 a.m.
Message ID <877ggpy15n.wl%atzm@stratosphere.co.jp>
Download mbox | patch
Permalink /patch/259654/
State Superseded
Delegated to: stephen hemminger
Headers show

Comments

Atzm Watanabe - July 17, 2013, 9:40 a.m.
This patch allows setting VXLAN destination to unicast address.
It allows that VXLAN can be used as peer-to-peer tunnel without
multicast.

v5: rebase on the latest.

v4: replace "group" with "remote" based by David Stevens's comments.

v3: move a new attribute REMOTE into the last of an enum list
    based by Stephen Hemminger's comments.
    fix the usage to show explicitly that both "remote" and "group"
    cannot be specified, based by Ben Hutchings's comments.

v2: use a new argument "remote" instead of "group" based by
    Stephen Hemminger's comments.

Signed-off-by: Atzm Watanabe <atzm@stratosphere.co.jp>
---
 ip/iplink_vxlan.c     | 17 +++++++----------
 man/man8/ip-link.8.in | 11 ++++++++---
 2 files changed, 15 insertions(+), 13 deletions(-)
WANG Cong - July 19, 2013, 8:12 a.m.
On Wed, 17 Jul 2013 at 09:40 GMT, Atzm Watanabe <atzm@stratosphere.co.jp> wrote:
> This patch allows setting VXLAN destination to unicast address.
> It allows that VXLAN can be used as peer-to-peer tunnel without
> multicast.
>
...
>  {
> -	fprintf(stderr, "Usage: ... vxlan id VNI [ group ADDR ] [ local ADDR ]\n");
> +	fprintf(stderr, "Usage: ... vxlan id VNI [ remote ADDR ] [ local ADDR ]\n");

This clearly breaks existing scripts, you should keep 'group' and just add
'remote'.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Atzm Watanabe - July 19, 2013, 11:44 a.m.
At Fri, 19 Jul 2013 08:12:40 +0000 (UTC),
Cong Wang wrote:
> 
> On Wed, 17 Jul 2013 at 09:40 GMT, Atzm Watanabe <atzm@stratosphere.co.jp> wrote:
> > This patch allows setting VXLAN destination to unicast address.
> > It allows that VXLAN can be used as peer-to-peer tunnel without
> > multicast.
> >
> ...
> >  {
> > -	fprintf(stderr, "Usage: ... vxlan id VNI [ group ADDR ] [ local ADDR ]\n");
> > +	fprintf(stderr, "Usage: ... vxlan id VNI [ remote ADDR ] [ local ADDR ]\n");
> 
> This clearly breaks existing scripts, you should keep 'group' and just add
> 'remote'.

Yes, will fix this like the patch v3 but without adding/changing
IFLA_VXLAN_* attributes.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/ip/iplink_vxlan.c b/ip/iplink_vxlan.c
index 1025326..0f9cccf 100644
--- a/ip/iplink_vxlan.c
+++ b/ip/iplink_vxlan.c
@@ -23,7 +23,7 @@ 
 
 static void explain(void)
 {
-	fprintf(stderr, "Usage: ... vxlan id VNI [ group ADDR ] [ local ADDR ]\n");
+	fprintf(stderr, "Usage: ... vxlan id VNI [ remote ADDR ] [ local ADDR ]\n");
 	fprintf(stderr, "                 [ ttl TTL ] [ tos TOS ] [ dev PHYS_DEV ]\n");
 	fprintf(stderr, "                 [ port MIN MAX ] [ [no]learning ]\n");
 	fprintf(stderr, "                 [ [no]proxy ] [ [no]rsc ]\n");
@@ -41,7 +41,7 @@  static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
 	__u32 vni = 0;
 	int vni_set = 0;
 	__u32 saddr = 0;
-	__u32 gaddr = 0;
+	__u32 daddr = 0;
 	unsigned link = 0;
 	__u8 tos = 0;
 	__u8 ttl = 0;
@@ -63,12 +63,9 @@  static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
 			    vni >= 1u << 24)
 				invarg("invalid id", *argv);
 			vni_set = 1;
-		} else if (!matches(*argv, "group")) {
+		} else if (!matches(*argv, "remote")) {
 			NEXT_ARG();
-			gaddr = get_addr32(*argv);
-
-			if (!IN_MULTICAST(ntohl(gaddr)))
-				invarg("invald group address", *argv);
+			daddr = get_addr32(*argv);
 		} else if (!matches(*argv, "local")) {
 			NEXT_ARG();
 			if (strcmp(*argv, "any"))
@@ -161,8 +158,8 @@  static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
 		return -1;
 	}
 	addattr32(n, 1024, IFLA_VXLAN_ID, vni);
-	if (gaddr)
-		addattr_l(n, 1024, IFLA_VXLAN_GROUP, &gaddr, 4);
+	if (daddr)
+		addattr_l(n, 1024, IFLA_VXLAN_GROUP, &daddr, 4);
 	if (saddr)
 		addattr_l(n, 1024, IFLA_VXLAN_LOCAL, &saddr, 4);
 	if (link)
@@ -209,7 +206,7 @@  static void vxlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
 	if (tb[IFLA_VXLAN_GROUP]) {
 		__be32 addr = rta_getattr_u32(tb[IFLA_VXLAN_GROUP]);
 		if (addr)
-			fprintf(f, "group %s ",
+			fprintf(f, "remote %s ",
 				format_host(AF_INET, 4, &addr, s1, sizeof(s1)));
 	}
 
diff --git a/man/man8/ip-link.8.in b/man/man8/ip-link.8.in
index 86e0bc9..25e2f31 100644
--- a/man/man8/ip-link.8.in
+++ b/man/man8/ip-link.8.in
@@ -207,7 +207,7 @@  the following additional arguments are supported:
 .R " [ "
 .BI dev " PHYS_DEV "
 .R " ] [ "
-.BI group " IPADDR "
+.BI remote " IPADDR "
 .R " ] [ "
 .BI local " IPADDR "
 .R " ] [ "
@@ -238,8 +238,13 @@  Identifier) to use.
 - specifies the physical device to use for tunnel endpoint communication.
 
 .sp
-.BI group " IPADDR"
-- specifies the multicast IP address to join.
+.BI remote " IPADDR"
+- specifies the destination IP address to use in outgoing packets when
+the destination link layer address is not known in the VXLAN device
+forwarding database.
+.I IPADDR
+will also be used to join the group if a multicast IP address is
+specified.
 
 .sp
 .BI local " IPADDR"