* [PATCH iproute2] vxlan: add ipv6 support
2013-03-31 5:43 [Patch net-next v1 1/4] vxlan: defer vxlan init as late as possible Cong Wang
@ 2013-03-31 6:17 ` Cong Wang
0 siblings, 0 replies; 11+ messages in thread
From: Cong Wang @ 2013-03-31 6:17 UTC (permalink / raw)
To: netdev; +Cc: Stephen Hemminger, Cong Wang
From: Cong Wang <amwang@redhat.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Cong Wang <amwang@redhat.com>
---
include/linux/if_link.h | 2 ++
ip/iplink_vxlan.c | 45 ++++++++++++++++++++++++++++++++++++++-------
2 files changed, 40 insertions(+), 7 deletions(-)
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index 40167af..f74b8cc 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -306,6 +306,8 @@ enum {
IFLA_VXLAN_RSC,
IFLA_VXLAN_L2MISS,
IFLA_VXLAN_L3MISS,
+ IFLA_VXLAN_GROUP6,
+ IFLA_VXLAN_LOCAL6,
__IFLA_VXLAN_MAX
};
#define IFLA_VXLAN_MAX (__IFLA_VXLAN_MAX - 1)
diff --git a/ip/iplink_vxlan.c b/ip/iplink_vxlan.c
index 1025326..c10ec0f 100644
--- a/ip/iplink_vxlan.c
+++ b/ip/iplink_vxlan.c
@@ -42,6 +42,8 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
int vni_set = 0;
__u32 saddr = 0;
__u32 gaddr = 0;
+ struct in6_addr saddr6 = IN6ADDR_ANY_INIT;
+ struct in6_addr gaddr6 = IN6ADDR_ANY_INIT;
unsigned link = 0;
__u8 tos = 0;
__u8 ttl = 0;
@@ -65,15 +67,26 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
vni_set = 1;
} else if (!matches(*argv, "group")) {
NEXT_ARG();
- gaddr = get_addr32(*argv);
-
- if (!IN_MULTICAST(ntohl(gaddr)))
- invarg("invald group address", *argv);
+ 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);
} else if (!matches(*argv, "local")) {
NEXT_ARG();
- if (strcmp(*argv, "any"))
- saddr = get_addr32(*argv);
- if (IN_MULTICAST(ntohl(saddr)))
+ if (strcmp(*argv, "any")) {
+ if (!inet_pton(AF_INET, *argv, &saddr)) {
+ if (!inet_pton(AF_INET6, *argv, &saddr6)) {
+ fprintf(stderr, "Invalid address \"%s\"\n", *argv);
+ return -1;
+ }
+ }
+ }
+
+ if (IN_MULTICAST(ntohl(saddr)) || IN6_IS_ADDR_MULTICAST(&saddr6))
invarg("invalid local address", *argv);
} else if (!matches(*argv, "dev")) {
NEXT_ARG();
@@ -163,8 +176,14 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
addattr32(n, 1024, IFLA_VXLAN_ID, vni);
if (gaddr)
addattr_l(n, 1024, IFLA_VXLAN_GROUP, &gaddr, 4);
+ else if (memcmp(&gaddr6, &in6addr_any, sizeof(gaddr6)) != 0)
+ addattr_l(n, 1024, IFLA_VXLAN_GROUP6, &gaddr6, sizeof(struct in6_addr));
+
if (saddr)
addattr_l(n, 1024, IFLA_VXLAN_LOCAL, &saddr, 4);
+ else if (memcmp(&saddr6, &in6addr_any, sizeof(saddr6)) != 0)
+ addattr_l(n, 1024, IFLA_VXLAN_LOCAL6, &saddr6, sizeof(struct in6_addr));
+
if (link)
addattr32(n, 1024, IFLA_VXLAN_LINK, link);
addattr8(n, 1024, IFLA_VXLAN_TTL, ttl);
@@ -211,6 +230,12 @@ static void vxlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
if (addr)
fprintf(f, "group %s ",
format_host(AF_INET, 4, &addr, s1, sizeof(s1)));
+ } else if (tb[IFLA_VXLAN_GROUP6]) {
+ struct in6_addr addr;
+ memcpy(&addr, RTA_DATA(tb[IFLA_VXLAN_GROUP6]), sizeof(struct in6_addr));
+ if (memcmp(&addr, &in6addr_any, sizeof(addr)) != 0)
+ fprintf(f, "group %s ",
+ format_host(AF_INET6, sizeof(struct in6_addr), &addr, s1, sizeof(s1)));
}
if (tb[IFLA_VXLAN_LOCAL]) {
@@ -218,6 +243,12 @@ static void vxlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
if (addr)
fprintf(f, "local %s ",
format_host(AF_INET, 4, &addr, s1, sizeof(s1)));
+ } else if (tb[IFLA_VXLAN_LOCAL6]) {
+ struct in6_addr addr;
+ memcpy(&addr, RTA_DATA(tb[IFLA_VXLAN_LOCAL6]), sizeof(struct in6_addr));
+ if (memcmp(&addr, &in6addr_any, sizeof(addr)) != 0)
+ fprintf(f, "local %s ",
+ format_host(AF_INET6, sizeof(struct in6_addr), &addr, s1, sizeof(s1)));
}
if (tb[IFLA_VXLAN_LINK] &&
--
1.7.7.6
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH iproute2] vxlan: add ipv6 support
2013-04-05 12:16 [Patch net-next v2 1/4] vxlan: defer vxlan init as late as possible Cong Wang
@ 2013-04-05 12:16 ` Cong Wang
0 siblings, 0 replies; 11+ messages in thread
From: Cong Wang @ 2013-04-05 12:16 UTC (permalink / raw)
To: netdev; +Cc: Stephen Hemminger, Cong Wang
From: Cong Wang <amwang@redhat.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Cong Wang <amwang@redhat.com>
---
include/linux/if_link.h | 2 ++
ip/iplink_vxlan.c | 45 ++++++++++++++++++++++++++++++++++++++-------
2 files changed, 40 insertions(+), 7 deletions(-)
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index 40167af..f74b8cc 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -306,6 +306,8 @@ enum {
IFLA_VXLAN_RSC,
IFLA_VXLAN_L2MISS,
IFLA_VXLAN_L3MISS,
+ IFLA_VXLAN_GROUP6,
+ IFLA_VXLAN_LOCAL6,
__IFLA_VXLAN_MAX
};
#define IFLA_VXLAN_MAX (__IFLA_VXLAN_MAX - 1)
diff --git a/ip/iplink_vxlan.c b/ip/iplink_vxlan.c
index 1025326..c10ec0f 100644
--- a/ip/iplink_vxlan.c
+++ b/ip/iplink_vxlan.c
@@ -42,6 +42,8 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
int vni_set = 0;
__u32 saddr = 0;
__u32 gaddr = 0;
+ struct in6_addr saddr6 = IN6ADDR_ANY_INIT;
+ struct in6_addr gaddr6 = IN6ADDR_ANY_INIT;
unsigned link = 0;
__u8 tos = 0;
__u8 ttl = 0;
@@ -65,15 +67,26 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
vni_set = 1;
} else if (!matches(*argv, "group")) {
NEXT_ARG();
- gaddr = get_addr32(*argv);
-
- if (!IN_MULTICAST(ntohl(gaddr)))
- invarg("invald group address", *argv);
+ 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);
} else if (!matches(*argv, "local")) {
NEXT_ARG();
- if (strcmp(*argv, "any"))
- saddr = get_addr32(*argv);
- if (IN_MULTICAST(ntohl(saddr)))
+ if (strcmp(*argv, "any")) {
+ if (!inet_pton(AF_INET, *argv, &saddr)) {
+ if (!inet_pton(AF_INET6, *argv, &saddr6)) {
+ fprintf(stderr, "Invalid address \"%s\"\n", *argv);
+ return -1;
+ }
+ }
+ }
+
+ if (IN_MULTICAST(ntohl(saddr)) || IN6_IS_ADDR_MULTICAST(&saddr6))
invarg("invalid local address", *argv);
} else if (!matches(*argv, "dev")) {
NEXT_ARG();
@@ -163,8 +176,14 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
addattr32(n, 1024, IFLA_VXLAN_ID, vni);
if (gaddr)
addattr_l(n, 1024, IFLA_VXLAN_GROUP, &gaddr, 4);
+ else if (memcmp(&gaddr6, &in6addr_any, sizeof(gaddr6)) != 0)
+ addattr_l(n, 1024, IFLA_VXLAN_GROUP6, &gaddr6, sizeof(struct in6_addr));
+
if (saddr)
addattr_l(n, 1024, IFLA_VXLAN_LOCAL, &saddr, 4);
+ else if (memcmp(&saddr6, &in6addr_any, sizeof(saddr6)) != 0)
+ addattr_l(n, 1024, IFLA_VXLAN_LOCAL6, &saddr6, sizeof(struct in6_addr));
+
if (link)
addattr32(n, 1024, IFLA_VXLAN_LINK, link);
addattr8(n, 1024, IFLA_VXLAN_TTL, ttl);
@@ -211,6 +230,12 @@ static void vxlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
if (addr)
fprintf(f, "group %s ",
format_host(AF_INET, 4, &addr, s1, sizeof(s1)));
+ } else if (tb[IFLA_VXLAN_GROUP6]) {
+ struct in6_addr addr;
+ memcpy(&addr, RTA_DATA(tb[IFLA_VXLAN_GROUP6]), sizeof(struct in6_addr));
+ if (memcmp(&addr, &in6addr_any, sizeof(addr)) != 0)
+ fprintf(f, "group %s ",
+ format_host(AF_INET6, sizeof(struct in6_addr), &addr, s1, sizeof(s1)));
}
if (tb[IFLA_VXLAN_LOCAL]) {
@@ -218,6 +243,12 @@ static void vxlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
if (addr)
fprintf(f, "local %s ",
format_host(AF_INET, 4, &addr, s1, sizeof(s1)));
+ } else if (tb[IFLA_VXLAN_LOCAL6]) {
+ struct in6_addr addr;
+ memcpy(&addr, RTA_DATA(tb[IFLA_VXLAN_LOCAL6]), sizeof(struct in6_addr));
+ if (memcmp(&addr, &in6addr_any, sizeof(addr)) != 0)
+ fprintf(f, "local %s ",
+ format_host(AF_INET6, sizeof(struct in6_addr), &addr, s1, sizeof(s1)));
}
if (tb[IFLA_VXLAN_LINK] &&
--
1.7.7.6
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH iproute2] vxlan: add ipv6 support
2013-04-08 2:18 [Patch net-next v3 1/4] vxlan: defer vxlan init as late as possible Cong Wang
@ 2013-04-08 2:18 ` Cong Wang
0 siblings, 0 replies; 11+ messages in thread
From: Cong Wang @ 2013-04-08 2:18 UTC (permalink / raw)
To: netdev; +Cc: Stephen Hemminger, Cong Wang
From: Cong Wang <amwang@redhat.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Cong Wang <amwang@redhat.com>
---
include/linux/if_link.h | 2 ++
ip/iplink_vxlan.c | 45 ++++++++++++++++++++++++++++++++++++++-------
2 files changed, 40 insertions(+), 7 deletions(-)
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index 40167af..f74b8cc 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -306,6 +306,8 @@ enum {
IFLA_VXLAN_RSC,
IFLA_VXLAN_L2MISS,
IFLA_VXLAN_L3MISS,
+ IFLA_VXLAN_GROUP6,
+ IFLA_VXLAN_LOCAL6,
__IFLA_VXLAN_MAX
};
#define IFLA_VXLAN_MAX (__IFLA_VXLAN_MAX - 1)
diff --git a/ip/iplink_vxlan.c b/ip/iplink_vxlan.c
index 1025326..c10ec0f 100644
--- a/ip/iplink_vxlan.c
+++ b/ip/iplink_vxlan.c
@@ -42,6 +42,8 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
int vni_set = 0;
__u32 saddr = 0;
__u32 gaddr = 0;
+ struct in6_addr saddr6 = IN6ADDR_ANY_INIT;
+ struct in6_addr gaddr6 = IN6ADDR_ANY_INIT;
unsigned link = 0;
__u8 tos = 0;
__u8 ttl = 0;
@@ -65,15 +67,26 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
vni_set = 1;
} else if (!matches(*argv, "group")) {
NEXT_ARG();
- gaddr = get_addr32(*argv);
-
- if (!IN_MULTICAST(ntohl(gaddr)))
- invarg("invald group address", *argv);
+ 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);
} else if (!matches(*argv, "local")) {
NEXT_ARG();
- if (strcmp(*argv, "any"))
- saddr = get_addr32(*argv);
- if (IN_MULTICAST(ntohl(saddr)))
+ if (strcmp(*argv, "any")) {
+ if (!inet_pton(AF_INET, *argv, &saddr)) {
+ if (!inet_pton(AF_INET6, *argv, &saddr6)) {
+ fprintf(stderr, "Invalid address \"%s\"\n", *argv);
+ return -1;
+ }
+ }
+ }
+
+ if (IN_MULTICAST(ntohl(saddr)) || IN6_IS_ADDR_MULTICAST(&saddr6))
invarg("invalid local address", *argv);
} else if (!matches(*argv, "dev")) {
NEXT_ARG();
@@ -163,8 +176,14 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
addattr32(n, 1024, IFLA_VXLAN_ID, vni);
if (gaddr)
addattr_l(n, 1024, IFLA_VXLAN_GROUP, &gaddr, 4);
+ else if (memcmp(&gaddr6, &in6addr_any, sizeof(gaddr6)) != 0)
+ addattr_l(n, 1024, IFLA_VXLAN_GROUP6, &gaddr6, sizeof(struct in6_addr));
+
if (saddr)
addattr_l(n, 1024, IFLA_VXLAN_LOCAL, &saddr, 4);
+ else if (memcmp(&saddr6, &in6addr_any, sizeof(saddr6)) != 0)
+ addattr_l(n, 1024, IFLA_VXLAN_LOCAL6, &saddr6, sizeof(struct in6_addr));
+
if (link)
addattr32(n, 1024, IFLA_VXLAN_LINK, link);
addattr8(n, 1024, IFLA_VXLAN_TTL, ttl);
@@ -211,6 +230,12 @@ static void vxlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
if (addr)
fprintf(f, "group %s ",
format_host(AF_INET, 4, &addr, s1, sizeof(s1)));
+ } else if (tb[IFLA_VXLAN_GROUP6]) {
+ struct in6_addr addr;
+ memcpy(&addr, RTA_DATA(tb[IFLA_VXLAN_GROUP6]), sizeof(struct in6_addr));
+ if (memcmp(&addr, &in6addr_any, sizeof(addr)) != 0)
+ fprintf(f, "group %s ",
+ format_host(AF_INET6, sizeof(struct in6_addr), &addr, s1, sizeof(s1)));
}
if (tb[IFLA_VXLAN_LOCAL]) {
@@ -218,6 +243,12 @@ static void vxlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
if (addr)
fprintf(f, "local %s ",
format_host(AF_INET, 4, &addr, s1, sizeof(s1)));
+ } else if (tb[IFLA_VXLAN_LOCAL6]) {
+ struct in6_addr addr;
+ memcpy(&addr, RTA_DATA(tb[IFLA_VXLAN_LOCAL6]), sizeof(struct in6_addr));
+ if (memcmp(&addr, &in6addr_any, sizeof(addr)) != 0)
+ fprintf(f, "local %s ",
+ format_host(AF_INET6, sizeof(struct in6_addr), &addr, s1, sizeof(s1)));
}
if (tb[IFLA_VXLAN_LINK] &&
--
1.7.7.6
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH iproute2] vxlan: add ipv6 support
2013-04-17 5:10 [Patch net-next v4 0/5] " Cong Wang
@ 2013-04-17 5:10 ` Cong Wang
2013-04-18 22:55 ` Stephen Hemminger
2013-04-18 22:57 ` Stephen Hemminger
0 siblings, 2 replies; 11+ messages in thread
From: Cong Wang @ 2013-04-17 5:10 UTC (permalink / raw)
To: netdev; +Cc: Stephen Hemminger, Cong Wang
From: Cong Wang <amwang@redhat.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Cong Wang <amwang@redhat.com>
---
include/linux/if_link.h | 2 ++
ip/iplink_vxlan.c | 45 ++++++++++++++++++++++++++++++++++++++-------
2 files changed, 40 insertions(+), 7 deletions(-)
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index 40167af..a5f43d5 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -306,6 +306,8 @@ enum {
IFLA_VXLAN_RSC,
IFLA_VXLAN_L2MISS,
IFLA_VXLAN_L3MISS,
+ IFLA_VXLAN_REMOTE6,
+ IFLA_VXLAN_LOCAL6,
__IFLA_VXLAN_MAX
};
#define IFLA_VXLAN_MAX (__IFLA_VXLAN_MAX - 1)
diff --git a/ip/iplink_vxlan.c b/ip/iplink_vxlan.c
index 1025326..661ab9e 100644
--- a/ip/iplink_vxlan.c
+++ b/ip/iplink_vxlan.c
@@ -42,6 +42,8 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
int vni_set = 0;
__u32 saddr = 0;
__u32 gaddr = 0;
+ struct in6_addr saddr6 = IN6ADDR_ANY_INIT;
+ struct in6_addr gaddr6 = IN6ADDR_ANY_INIT;
unsigned link = 0;
__u8 tos = 0;
__u8 ttl = 0;
@@ -65,15 +67,26 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
vni_set = 1;
} else if (!matches(*argv, "group")) {
NEXT_ARG();
- gaddr = get_addr32(*argv);
-
- if (!IN_MULTICAST(ntohl(gaddr)))
- invarg("invald group address", *argv);
+ 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);
} else if (!matches(*argv, "local")) {
NEXT_ARG();
- if (strcmp(*argv, "any"))
- saddr = get_addr32(*argv);
- if (IN_MULTICAST(ntohl(saddr)))
+ if (strcmp(*argv, "any")) {
+ if (!inet_pton(AF_INET, *argv, &saddr)) {
+ if (!inet_pton(AF_INET6, *argv, &saddr6)) {
+ fprintf(stderr, "Invalid address \"%s\"\n", *argv);
+ return -1;
+ }
+ }
+ }
+
+ if (IN_MULTICAST(ntohl(saddr)) || IN6_IS_ADDR_MULTICAST(&saddr6))
invarg("invalid local address", *argv);
} else if (!matches(*argv, "dev")) {
NEXT_ARG();
@@ -163,8 +176,14 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
addattr32(n, 1024, IFLA_VXLAN_ID, vni);
if (gaddr)
addattr_l(n, 1024, IFLA_VXLAN_GROUP, &gaddr, 4);
+ else if (memcmp(&gaddr6, &in6addr_any, sizeof(gaddr6)) != 0)
+ addattr_l(n, 1024, IFLA_VXLAN_REMOTE6, &gaddr6, sizeof(struct in6_addr));
+
if (saddr)
addattr_l(n, 1024, IFLA_VXLAN_LOCAL, &saddr, 4);
+ else if (memcmp(&saddr6, &in6addr_any, sizeof(saddr6)) != 0)
+ addattr_l(n, 1024, IFLA_VXLAN_LOCAL6, &saddr6, sizeof(struct in6_addr));
+
if (link)
addattr32(n, 1024, IFLA_VXLAN_LINK, link);
addattr8(n, 1024, IFLA_VXLAN_TTL, ttl);
@@ -211,6 +230,12 @@ static void vxlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
if (addr)
fprintf(f, "group %s ",
format_host(AF_INET, 4, &addr, s1, sizeof(s1)));
+ } else if (tb[IFLA_VXLAN_REMOTE6]) {
+ struct in6_addr addr;
+ memcpy(&addr, RTA_DATA(tb[IFLA_VXLAN_REMOTE6]), sizeof(struct in6_addr));
+ if (memcmp(&addr, &in6addr_any, sizeof(addr)) != 0)
+ fprintf(f, "group %s ",
+ format_host(AF_INET6, sizeof(struct in6_addr), &addr, s1, sizeof(s1)));
}
if (tb[IFLA_VXLAN_LOCAL]) {
@@ -218,6 +243,12 @@ static void vxlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
if (addr)
fprintf(f, "local %s ",
format_host(AF_INET, 4, &addr, s1, sizeof(s1)));
+ } else if (tb[IFLA_VXLAN_LOCAL6]) {
+ struct in6_addr addr;
+ memcpy(&addr, RTA_DATA(tb[IFLA_VXLAN_LOCAL6]), sizeof(struct in6_addr));
+ if (memcmp(&addr, &in6addr_any, sizeof(addr)) != 0)
+ fprintf(f, "local %s ",
+ format_host(AF_INET6, sizeof(struct in6_addr), &addr, s1, sizeof(s1)));
}
if (tb[IFLA_VXLAN_LINK] &&
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH iproute2] vxlan: add ipv6 support
2013-04-17 5:10 ` [PATCH iproute2] " Cong Wang
@ 2013-04-18 22:55 ` Stephen Hemminger
2013-04-19 11:36 ` Cong Wang
2013-04-18 22:57 ` Stephen Hemminger
1 sibling, 1 reply; 11+ messages in thread
From: Stephen Hemminger @ 2013-04-18 22:55 UTC (permalink / raw)
To: Cong Wang; +Cc: netdev
On Wed, 17 Apr 2013 13:10:23 +0800
Cong Wang <amwang@redhat.com> wrote:
> From: Cong Wang <amwang@redhat.com>
>
> Cc: Stephen Hemminger <stephen@networkplumber.org>
> Signed-off-by: Cong Wang <amwang@redhat.com>
> ---
> include/linux/if_link.h | 2 ++
> ip/iplink_vxlan.c | 45 ++++++++++++++++++++++++++++++++++++++-------
> 2 files changed, 40 insertions(+), 7 deletions(-)
>
Resubmit after net-next is merged to upstream.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH iproute2] vxlan: add ipv6 support
2013-04-17 5:10 ` [PATCH iproute2] " Cong Wang
2013-04-18 22:55 ` Stephen Hemminger
@ 2013-04-18 22:57 ` Stephen Hemminger
2013-04-19 14:20 ` Cong Wang
1 sibling, 1 reply; 11+ messages in thread
From: Stephen Hemminger @ 2013-04-18 22:57 UTC (permalink / raw)
To: Cong Wang; +Cc: netdev
On Wed, 17 Apr 2013 13:10:23 +0800
Cong Wang <amwang@redhat.com> wrote:
> + 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);
Maybe using getaddrinfo would be better to allow symbolic names as well?
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH iproute2] vxlan: add ipv6 support
2013-04-18 22:55 ` Stephen Hemminger
@ 2013-04-19 11:36 ` Cong Wang
0 siblings, 0 replies; 11+ messages in thread
From: Cong Wang @ 2013-04-19 11:36 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev
On Thu, 2013-04-18 at 15:55 -0700, Stephen Hemminger wrote:
> On Wed, 17 Apr 2013 13:10:23 +0800
> Cong Wang <amwang@redhat.com> wrote:
>
> > From: Cong Wang <amwang@redhat.com>
> >
> > Cc: Stephen Hemminger <stephen@networkplumber.org>
> > Signed-off-by: Cong Wang <amwang@redhat.com>
> > ---
> > include/linux/if_link.h | 2 ++
> > ip/iplink_vxlan.c | 45 ++++++++++++++++++++++++++++++++++++++-------
> > 2 files changed, 40 insertions(+), 7 deletions(-)
> >
>
> Resubmit after net-next is merged to upstream.
Sure, I carry it for completeness.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH iproute2] vxlan: add ipv6 support
2013-04-18 22:57 ` Stephen Hemminger
@ 2013-04-19 14:20 ` Cong Wang
2013-04-19 15:26 ` Stephen Hemminger
0 siblings, 1 reply; 11+ messages in thread
From: Cong Wang @ 2013-04-19 14:20 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev
On Thu, 2013-04-18 at 15:57 -0700, Stephen Hemminger wrote:
> On Wed, 17 Apr 2013 13:10:23 +0800
> Cong Wang <amwang@redhat.com> wrote:
>
> > + 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);
>
> Maybe using getaddrinfo would be better to allow symbolic names as well?
Yes, but I don't think many people use symbolic name for a multicast
group?
Thanks.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH iproute2] vxlan: add ipv6 support
2013-04-19 14:20 ` Cong Wang
@ 2013-04-19 15:26 ` Stephen Hemminger
0 siblings, 0 replies; 11+ messages in thread
From: Stephen Hemminger @ 2013-04-19 15:26 UTC (permalink / raw)
To: Cong Wang; +Cc: netdev
On Fri, 19 Apr 2013 22:20:12 +0800
Cong Wang <amwang@redhat.com> wrote:
> On Thu, 2013-04-18 at 15:57 -0700, Stephen Hemminger wrote:
> > On Wed, 17 Apr 2013 13:10:23 +0800
> > Cong Wang <amwang@redhat.com> wrote:
> >
> > > + 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);
> >
> > Maybe using getaddrinfo would be better to allow symbolic names as well?
>
> Yes, but I don't think many people use symbolic name for a multicast
> group?
>
> Thanks.
>
You can use AI_NUMERICHOST to avoid symbolic names.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Patch iproute2] vxlan: add ipv6 support
@ 2013-09-03 3:33 Cong Wang
2013-09-12 7:16 ` Cong Wang
0 siblings, 1 reply; 11+ messages in thread
From: Cong Wang @ 2013-09-03 3:33 UTC (permalink / raw)
To: netdev; +Cc: David S. Miller, Stephen Hemminger, Cong Wang
From: Cong Wang <amwang@redhat.com>
The kernel already supports it, so add the support
to iproute2 as well.
Cc: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Cong Wang <amwang@redhat.com>
---
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index d07aeca..0c37561 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -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)
diff --git a/ip/iplink_vxlan.c b/ip/iplink_vxlan.c
index 4304b0d..12e1c74 100644
--- a/ip/iplink_vxlan.c
+++ b/ip/iplink_vxlan.c
@@ -43,6 +43,9 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
__u32 saddr = 0;
__u32 gaddr = 0;
__u32 daddr = 0;
+ struct in6_addr saddr6 = IN6ADDR_ANY_INIT;
+ struct in6_addr gaddr6 = IN6ADDR_ANY_INIT;
+ struct in6_addr daddr6 = IN6ADDR_ANY_INIT;
unsigned link = 0;
__u8 tos = 0;
__u8 ttl = 0;
@@ -66,21 +69,36 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
vni_set = 1;
} else if (!matches(*argv, "group")) {
NEXT_ARG();
- gaddr = get_addr32(*argv);
-
- if (!IN_MULTICAST(ntohl(gaddr)))
- invarg("invalid group address", *argv);
+ 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);
} else if (!matches(*argv, "remote")) {
NEXT_ARG();
- daddr = get_addr32(*argv);
-
- if (IN_MULTICAST(ntohl(daddr)))
- invarg("invalid remote address", *argv);
+ if (!inet_pton(AF_INET, *argv, &daddr)) {
+ if (!inet_pton(AF_INET6, *argv, &daddr6)) {
+ fprintf(stderr, "Invalid address \"%s\"\n", *argv);
+ return -1;
+ } else if (IN6_IS_ADDR_MULTICAST(&daddr6))
+ invarg("invald remote address", *argv);
+ } else if (IN_MULTICAST(ntohl(daddr)))
+ invarg("invald remote address", *argv);
} else if (!matches(*argv, "local")) {
NEXT_ARG();
- if (strcmp(*argv, "any"))
- saddr = get_addr32(*argv);
- if (IN_MULTICAST(ntohl(saddr)))
+ if (strcmp(*argv, "any")) {
+ if (!inet_pton(AF_INET, *argv, &saddr)) {
+ if (!inet_pton(AF_INET6, *argv, &saddr6)) {
+ fprintf(stderr, "Invalid address \"%s\"\n", *argv);
+ return -1;
+ }
+ }
+ }
+
+ if (IN_MULTICAST(ntohl(saddr)) || IN6_IS_ADDR_MULTICAST(&saddr6))
invarg("invalid local address", *argv);
} else if (!matches(*argv, "dev")) {
NEXT_ARG();
@@ -167,7 +185,9 @@ 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) {
+ if ((gaddr && daddr) ||
+ (memcmp(&gaddr6, &in6addr_any, sizeof(gaddr6)) &&
+ memcmp(&daddr6, &in6addr_any, sizeof(daddr6)))) {
fprintf(stderr, "vxlan: both group and remote cannot be specified\n");
return -1;
}
@@ -176,8 +196,16 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
addattr_l(n, 1024, IFLA_VXLAN_GROUP, &gaddr, 4);
else if (daddr)
addattr_l(n, 1024, IFLA_VXLAN_GROUP, &daddr, 4);
+ if (memcmp(&gaddr6, &in6addr_any, sizeof(gaddr6)) != 0)
+ addattr_l(n, 1024, IFLA_VXLAN_GROUP6, &gaddr6, sizeof(struct in6_addr));
+ else if (memcmp(&daddr6, &in6addr_any, sizeof(daddr6)) != 0)
+ addattr_l(n, 1024, IFLA_VXLAN_GROUP6, &daddr6, sizeof(struct in6_addr));
+
if (saddr)
addattr_l(n, 1024, IFLA_VXLAN_LOCAL, &saddr, 4);
+ else if (memcmp(&saddr6, &in6addr_any, sizeof(saddr6)) != 0)
+ addattr_l(n, 1024, IFLA_VXLAN_LOCAL6, &saddr6, sizeof(struct in6_addr));
+
if (link)
addattr32(n, 1024, IFLA_VXLAN_LINK, link);
addattr8(n, 1024, IFLA_VXLAN_TTL, ttl);
@@ -229,6 +257,17 @@ static void vxlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
fprintf(f, "remote %s ",
format_host(AF_INET, 4, &addr, s1, sizeof(s1)));
}
+ } else if (tb[IFLA_VXLAN_GROUP6]) {
+ struct in6_addr addr;
+ memcpy(&addr, RTA_DATA(tb[IFLA_VXLAN_GROUP6]), sizeof(struct in6_addr));
+ if (memcmp(&addr, &in6addr_any, sizeof(addr)) != 0) {
+ if (IN6_IS_ADDR_MULTICAST(&addr))
+ fprintf(f, "group %s ",
+ format_host(AF_INET6, sizeof(struct in6_addr), &addr, s1, sizeof(s1)));
+ else
+ fprintf(f, "remote %s ",
+ format_host(AF_INET6, sizeof(struct in6_addr), &addr, s1, sizeof(s1)));
+ }
}
if (tb[IFLA_VXLAN_LOCAL]) {
@@ -236,6 +275,12 @@ static void vxlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
if (addr)
fprintf(f, "local %s ",
format_host(AF_INET, 4, &addr, s1, sizeof(s1)));
+ } else if (tb[IFLA_VXLAN_LOCAL6]) {
+ struct in6_addr addr;
+ memcpy(&addr, RTA_DATA(tb[IFLA_VXLAN_LOCAL6]), sizeof(struct in6_addr));
+ if (memcmp(&addr, &in6addr_any, sizeof(addr)) != 0)
+ fprintf(f, "local %s ",
+ format_host(AF_INET6, sizeof(struct in6_addr), &addr, s1, sizeof(s1)));
}
if (tb[IFLA_VXLAN_LINK] &&
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [Patch iproute2] vxlan: add ipv6 support
2013-09-03 3:33 [Patch iproute2] vxlan: add ipv6 support Cong Wang
@ 2013-09-12 7:16 ` Cong Wang
0 siblings, 0 replies; 11+ messages in thread
From: Cong Wang @ 2013-09-12 7:16 UTC (permalink / raw)
To: netdev; +Cc: David S. Miller, Stephen Hemminger
On Tue, 2013-09-03 at 11:33 +0800, Cong Wang wrote:
> From: Cong Wang <amwang@redhat.com>
>
> The kernel already supports it, so add the support
> to iproute2 as well.
>
> Cc: Stephen Hemminger <stephen@networkplumber.org>
> Signed-off-by: Cong Wang <amwang@redhat.com>
Stephen, could you take it if it looks good to you?
Thanks!
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2013-09-12 7:16 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-03 3:33 [Patch iproute2] vxlan: add ipv6 support Cong Wang
2013-09-12 7:16 ` Cong Wang
-- strict thread matches above, loose matches on Subject: below --
2013-04-17 5:10 [Patch net-next v4 0/5] " Cong Wang
2013-04-17 5:10 ` [PATCH iproute2] " Cong Wang
2013-04-18 22:55 ` Stephen Hemminger
2013-04-19 11:36 ` Cong Wang
2013-04-18 22:57 ` Stephen Hemminger
2013-04-19 14:20 ` Cong Wang
2013-04-19 15:26 ` Stephen Hemminger
2013-04-08 2:18 [Patch net-next v3 1/4] vxlan: defer vxlan init as late as possible Cong Wang
2013-04-08 2:18 ` [PATCH iproute2] vxlan: add ipv6 support Cong Wang
2013-04-05 12:16 [Patch net-next v2 1/4] vxlan: defer vxlan init as late as possible Cong Wang
2013-04-05 12:16 ` [PATCH iproute2] vxlan: add ipv6 support Cong Wang
2013-03-31 5:43 [Patch net-next v1 1/4] vxlan: defer vxlan init as late as possible Cong Wang
2013-03-31 6:17 ` [PATCH iproute2] vxlan: add ipv6 support Cong Wang
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).