All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH iproute2 v2] vxlan: Allow setting destination to unicast address.
@ 2013-04-11 10:17 Atzm Watanabe
  2013-04-11 15:24 ` Stephen Hemminger
  2013-04-11 17:48 ` Ben Hutchings
  0 siblings, 2 replies; 6+ messages in thread
From: Atzm Watanabe @ 2013-04-11 10:17 UTC (permalink / raw)
  To: netdev; +Cc: Stephen Hemminger

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

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

Signed-off-by: Atzm Watanabe <atzm@stratosphere.co.jp>
---
 include/linux/if_link.h |  1 +
 ip/iplink_vxlan.c       | 25 +++++++++++++++++++++++--
 2 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index 40167af..0bf03dc 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -296,6 +296,7 @@ enum {
 	IFLA_VXLAN_GROUP,
 	IFLA_VXLAN_LINK,
 	IFLA_VXLAN_LOCAL,
+	IFLA_VXLAN_REMOTE,
 	IFLA_VXLAN_TTL,
 	IFLA_VXLAN_TOS,
 	IFLA_VXLAN_LEARNING,
diff --git a/ip/iplink_vxlan.c b/ip/iplink_vxlan.c
index 1025326..ce2c30c 100644
--- a/ip/iplink_vxlan.c
+++ b/ip/iplink_vxlan.c
@@ -23,7 +23,8 @@
 
 static void explain(void)
 {
-	fprintf(stderr, "Usage: ... vxlan id VNI [ group ADDR ] [ local ADDR ]\n");
+	fprintf(stderr, "Usage: ... vxlan id VNI [ group ADDR ] [ remote ADDR ]\n");
+	fprintf(stderr, "                 [ 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,6 +42,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 daddr = 0;
 	__u32 gaddr = 0;
 	unsigned link = 0;
 	__u8 tos = 0;
@@ -68,7 +70,13 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
 			gaddr = get_addr32(*argv);
 
 			if (!IN_MULTICAST(ntohl(gaddr)))
-				invarg("invald group address", *argv);
+				invarg("invalid group address", *argv);
+		} else if (!matches(*argv, "remote")) {
+			NEXT_ARG();
+			daddr = get_addr32(*argv);
+
+			if (IN_MULTICAST(ntohl(daddr)))
+				invarg("invalid remote address", *argv);
 		} else if (!matches(*argv, "local")) {
 			NEXT_ARG();
 			if (strcmp(*argv, "any"))
@@ -160,9 +168,15 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
 		fprintf(stderr, "vxlan: missing virtual network identifier\n");
 		return -1;
 	}
+	if (gaddr && daddr) {
+		fprintf(stderr, "vxlan: both group and remote cannot be specified\n");
+		return -1;
+	}
 	addattr32(n, 1024, IFLA_VXLAN_ID, vni);
 	if (gaddr)
 		addattr_l(n, 1024, IFLA_VXLAN_GROUP, &gaddr, 4);
+	else if (daddr)
+		addattr_l(n, 1024, IFLA_VXLAN_REMOTE, &daddr, 4);
 	if (saddr)
 		addattr_l(n, 1024, IFLA_VXLAN_LOCAL, &saddr, 4);
 	if (link)
@@ -213,6 +227,13 @@ static void vxlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
 				format_host(AF_INET, 4, &addr, s1, sizeof(s1)));
 	}
 
+	if (tb[IFLA_VXLAN_REMOTE]) {
+		__be32 addr = rta_getattr_u32(tb[IFLA_VXLAN_REMOTE]);
+		if (addr)
+			fprintf(f, "remote %s ",
+				format_host(AF_INET, 4, &addr, s1, sizeof(s1)));
+	}
+
 	if (tb[IFLA_VXLAN_LOCAL]) {
 		__be32 addr = rta_getattr_u32(tb[IFLA_VXLAN_LOCAL]);
 		if (addr)
-- 
1.8.1.5

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

* Re: [PATCH iproute2 v2] vxlan: Allow setting destination to unicast address.
  2013-04-11 10:17 [PATCH iproute2 v2] vxlan: Allow setting destination to unicast address Atzm Watanabe
@ 2013-04-11 15:24 ` Stephen Hemminger
  2013-04-11 17:30   ` David Miller
  2013-04-11 17:48 ` Ben Hutchings
  1 sibling, 1 reply; 6+ messages in thread
From: Stephen Hemminger @ 2013-04-11 15:24 UTC (permalink / raw)
  To: Atzm Watanabe; +Cc: netdev

On Thu, 11 Apr 2013 19:17:54 +0900
Atzm Watanabe <atzm@stratosphere.co.jp> wrote:

> diff --git a/include/linux/if_link.h b/include/linux/if_link.h
> index 40167af..0bf03dc 100644
> --- a/include/linux/if_link.h
> +++ b/include/linux/if_link.h
> @@ -296,6 +296,7 @@ enum {
>  	IFLA_VXLAN_GROUP,
>  	IFLA_VXLAN_LINK,
>  	IFLA_VXLAN_LOCAL,
> +	IFLA_VXLAN_REMOTE,
>  	IFLA_VXLAN_TTL,
>  	IFLA_VXLAN_TOS,

You can't insert another value into the middle of an enum list.
It changes the kernel-userspace ABI values.

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

* Re: [PATCH iproute2 v2] vxlan: Allow setting destination to unicast address.
  2013-04-11 15:24 ` Stephen Hemminger
@ 2013-04-11 17:30   ` David Miller
  2013-04-12  5:31     ` Atzm Watanabe
  0 siblings, 1 reply; 6+ messages in thread
From: David Miller @ 2013-04-11 17:30 UTC (permalink / raw)
  To: stephen; +Cc: atzm, netdev

From: Stephen Hemminger <stephen@networkplumber.org>
Date: Thu, 11 Apr 2013 08:24:38 -0700

> On Thu, 11 Apr 2013 19:17:54 +0900
> Atzm Watanabe <atzm@stratosphere.co.jp> wrote:
> 
>> diff --git a/include/linux/if_link.h b/include/linux/if_link.h
>> index 40167af..0bf03dc 100644
>> --- a/include/linux/if_link.h
>> +++ b/include/linux/if_link.h
>> @@ -296,6 +296,7 @@ enum {
>>  	IFLA_VXLAN_GROUP,
>>  	IFLA_VXLAN_LINK,
>>  	IFLA_VXLAN_LOCAL,
>> +	IFLA_VXLAN_REMOTE,
>>  	IFLA_VXLAN_TTL,
>>  	IFLA_VXLAN_TOS,
> 
> You can't insert another value into the middle of an enum list.
> It changes the kernel-userspace ABI values.

Right.

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

* Re: [PATCH iproute2 v2] vxlan: Allow setting destination to unicast address.
  2013-04-11 10:17 [PATCH iproute2 v2] vxlan: Allow setting destination to unicast address Atzm Watanabe
  2013-04-11 15:24 ` Stephen Hemminger
@ 2013-04-11 17:48 ` Ben Hutchings
  2013-04-12  5:31   ` Atzm Watanabe
  1 sibling, 1 reply; 6+ messages in thread
From: Ben Hutchings @ 2013-04-11 17:48 UTC (permalink / raw)
  To: Atzm Watanabe; +Cc: netdev, Stephen Hemminger

On Thu, 2013-04-11 at 19:17 +0900, Atzm Watanabe wrote:
> This patch allows setting VXLAN destination to unicast address.
> It allows that VXLAN can be used as peer-to-peer tunnel without
> multicast.
> 
> v2: use a new argument "remote" instead of "group" based by
>     Stephen Hemminger's comments.
> 
> Signed-off-by: Atzm Watanabe <atzm@stratosphere.co.jp>
[...]
> --- a/ip/iplink_vxlan.c
> +++ b/ip/iplink_vxlan.c
> @@ -23,7 +23,8 @@
>  
>  static void explain(void)
>  {
> -	fprintf(stderr, "Usage: ... vxlan id VNI [ group ADDR ] [ local ADDR ]\n");
> +	fprintf(stderr, "Usage: ... vxlan id VNI [ group ADDR ] [ remote ADDR ]\n");
[...]

Shouldn't that be "[ group|remote ADDR ]", to show that you can specify
one or the other?

Ben.

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

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

* Re: [PATCH iproute2 v2] vxlan: Allow setting destination to unicast address.
  2013-04-11 17:30   ` David Miller
@ 2013-04-12  5:31     ` Atzm Watanabe
  0 siblings, 0 replies; 6+ messages in thread
From: Atzm Watanabe @ 2013-04-12  5:31 UTC (permalink / raw)
  To: David Miller; +Cc: stephen, netdev

At Thu, 11 Apr 2013 13:30:14 -0400 (EDT),
David Miller wrote:
> 
> From: Stephen Hemminger <stephen@networkplumber.org>
> Date: Thu, 11 Apr 2013 08:24:38 -0700
> 
> > On Thu, 11 Apr 2013 19:17:54 +0900
> > Atzm Watanabe <atzm@stratosphere.co.jp> wrote:
> > 
> >> diff --git a/include/linux/if_link.h b/include/linux/if_link.h
> >> index 40167af..0bf03dc 100644
> >> --- a/include/linux/if_link.h
> >> +++ b/include/linux/if_link.h
> >> @@ -296,6 +296,7 @@ enum {
> >>  	IFLA_VXLAN_GROUP,
> >>  	IFLA_VXLAN_LINK,
> >>  	IFLA_VXLAN_LOCAL,
> >> +	IFLA_VXLAN_REMOTE,
> >>  	IFLA_VXLAN_TTL,
> >>  	IFLA_VXLAN_TOS,
> > 
> > You can't insert another value into the middle of an enum list.
> > It changes the kernel-userspace ABI values.
> 
> Right.

Thank you for pointing it out.
I'll move IFLA_VXLAN_REMOTE to the last and resend the patch.

Thanks.

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

* Re: [PATCH iproute2 v2] vxlan: Allow setting destination to unicast address.
  2013-04-11 17:48 ` Ben Hutchings
@ 2013-04-12  5:31   ` Atzm Watanabe
  0 siblings, 0 replies; 6+ messages in thread
From: Atzm Watanabe @ 2013-04-12  5:31 UTC (permalink / raw)
  To: Ben Hutchings; +Cc: netdev, Stephen Hemminger

At Thu, 11 Apr 2013 18:48:20 +0100,
Ben Hutchings wrote:
> 
> On Thu, 2013-04-11 at 19:17 +0900, Atzm Watanabe wrote:
> > This patch allows setting VXLAN destination to unicast address.
> > It allows that VXLAN can be used as peer-to-peer tunnel without
> > multicast.
> > 
> > v2: use a new argument "remote" instead of "group" based by
> >     Stephen Hemminger's comments.
> > 
> > Signed-off-by: Atzm Watanabe <atzm@stratosphere.co.jp>
> [...]
> > --- a/ip/iplink_vxlan.c
> > +++ b/ip/iplink_vxlan.c
> > @@ -23,7 +23,8 @@
> >  
> >  static void explain(void)
> >  {
> > -	fprintf(stderr, "Usage: ... vxlan id VNI [ group ADDR ] [ local ADDR ]\n");
> > +	fprintf(stderr, "Usage: ... vxlan id VNI [ group ADDR ] [ remote ADDR ]\n");
> [...]
> 
> Shouldn't that be "[ group|remote ADDR ]", to show that you can specify
> one or the other?

Yes, basically I agreed.
I think this should be "[ { group | remote } ADDR ]",
to accommodate the notation to others.
I'll fix this and resend the patch.

Thanks.

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

end of thread, other threads:[~2013-04-12  5:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-11 10:17 [PATCH iproute2 v2] vxlan: Allow setting destination to unicast address Atzm Watanabe
2013-04-11 15:24 ` Stephen Hemminger
2013-04-11 17:30   ` David Miller
2013-04-12  5:31     ` Atzm Watanabe
2013-04-11 17:48 ` Ben Hutchings
2013-04-12  5:31   ` Atzm Watanabe

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.