Skip to contentSkip to conversation

vxlan: add ipv6 support

PATCH RESEND In review Cong Wang 2 participants 3 messages Sep 21, 2013 – Sep 24, 2013

Subsystems (2)
lore
Share & tools
lore

Cong Wang

author
#0 lore raw

PATCH RESEND 1/1 vxlan: add ipv6 support

From: Cong Wang <[email protected]>

The kernel already supports it, so add the support to iproute2 as well.

Cc Stephen Hemminger <[email protected]>
---
 include/linux/if_link.h |    2 +
 ip/iplink_vxlan.c       |   69 ++++++++++++++++++++++++++++++++++++++--------
 2 files changed, 59 insertions(+), 12 deletions(-)
include/linux/if_link.h +2 -0
index d07aeca..0c37561 100644
@@ -311,6 +311,8 @@ enum {
 	IFLA_VXLAN_L2MISS,
 	IFLA_VXLAN_L3MISS,
 	IFLA_VXLAN_PORT,	/* destination port */
+	IFLA_VXLAN_GROUP6,
+	IFLA_VXLAN_LOCAL6,
 	__IFLA_VXLAN_MAX
 };
 #define IFLA_VXLAN_MAX	(__IFLA_VXLAN_MAX - 1)
ip/iplink_vxlan.c +57 -12

111 lines not on this page · raw message

Signature · 1 line
1.7.7.6
#1 lore raw

ip/iplink_vxlan.c static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv, · line 79

Quoted 8 lines · On Sat, 21 Sep 2013 10:35:24 +0800 Cong Wang <[email protected]> wrote:
ip/iplink_vxlan.c +8 -0
+			if (!inet_pton(AF_INET, *argv, &gaddr)) {
+				if (!inet_pton(AF_INET6, *argv, &gaddr6)) {
+					fprintf(stderr, "Invalid address \"%s\"\n", *argv);
+					return -1;
+				} else if (!IN6_IS_ADDR_MULTICAST(&gaddr6))
+					invarg("invald group address", *argv);
+			} else if (!IN_MULTICAST(ntohl(gaddr)))
+					invarg("invald group address", *argv);

This is ugly, can't it be done more generically by checking for ':' in address. Or even use getaddrinfo.

Hate to have lots of special code to handle both address types.

author
#2 lore raw
Quoted 15 lines · Stephen Hemminger

ip/iplink_vxlan.c static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv, · line 79

Quoted 8 lines · On Sat, 21 Sep 2013 10:35:24 +0800 Cong Wang <[email protected]> wrote:
ip/iplink_vxlan.c +8 -0
+			if (!inet_pton(AF_INET, *argv, &gaddr)) {
+				if (!inet_pton(AF_INET6, *argv, &gaddr6)) {
+					fprintf(stderr, "Invalid address \"%s\"\n", *argv);
+					return -1;
+				} else if (!IN6_IS_ADDR_MULTICAST(&gaddr6))
+					invarg("invald group address", *argv);
+			} else if (!IN_MULTICAST(ntohl(gaddr)))
+					invarg("invald group address", *argv);

This is ugly, can't it be done more generically by checking for ':' in address. Or even use getaddrinfo.

Quoted 2 lines

Hate to have lots of special code to handle both address types.

Alright, I will introduce a helper function for it.

Thanks!