summaryrefslogtreecommitdiffstats
path: root/package/iproute2/iproute2-02-vxlan-optional-ipv6.patch
blob: 0d6cf9597155e922543adf27c7cac10994d0a2c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
Disable IPv6 support code in vxlan when building with uClibc configured without
IPv6 support.

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>

diff -Nura iproute2-3.12.0.orig/ip/iplink_vxlan.c iproute2-3.12.0/ip/iplink_vxlan.c
--- iproute2-3.12.0.orig/ip/iplink_vxlan.c	2013-11-26 14:09:13.804908955 -0300
+++ iproute2-3.12.0/ip/iplink_vxlan.c	2013-11-26 14:21:55.561997689 -0300
@@ -9,6 +9,11 @@
  * Authors:     Stephen Hemminger <shemminger@vyatta.com
  */
 
+#include <features.h>
+#if defined(__UCLIBC__) && !defined (__UCLIBC_HAS_IPV6__)
+#define NO_IPV6
+#endif
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -179,26 +184,32 @@
 		fprintf(stderr, "vxlan: missing virtual network identifier\n");
 		return -1;
 	}
+#ifndef NO_IPV6
 	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;
 	}
+#endif
 	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_GROUP, &daddr, 4);
+#ifndef NO_IPV6
 	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));
+#endif
 
 	if (saddr)
 		addattr_l(n, 1024, IFLA_VXLAN_LOCAL, &saddr, 4);
+#ifndef NO_IPV6
 	else if (memcmp(&saddr6, &in6addr_any, sizeof(saddr6)) != 0)
 		addattr_l(n, 1024, IFLA_VXLAN_LOCAL6, &saddr6, sizeof(struct in6_addr));
+#endif
 
 	if (link)
 		addattr32(n, 1024, IFLA_VXLAN_LINK, link);
@@ -251,6 +262,7 @@
 				fprintf(f, "remote %s ",
 					format_host(AF_INET, 4, &addr, s1, sizeof(s1)));
 		}
+#ifndef NO_IPV6
 	} else if (tb[IFLA_VXLAN_GROUP6]) {
 		struct in6_addr addr;
 		memcpy(&addr, RTA_DATA(tb[IFLA_VXLAN_GROUP6]), sizeof(struct in6_addr));
@@ -262,6 +274,7 @@
 				fprintf(f, "remote %s ",
 					format_host(AF_INET6, sizeof(struct in6_addr), &addr, s1, sizeof(s1)));
 		}
+#endif
 	}
 
 	if (tb[IFLA_VXLAN_LOCAL]) {
@@ -269,12 +282,14 @@
 		if (addr)
 			fprintf(f, "local %s ",
 				format_host(AF_INET, 4, &addr, s1, sizeof(s1)));
+#ifndef NO_IPV6
 	} 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)));
+#endif
 	}
 
 	if (tb[IFLA_VXLAN_LINK] &&
OpenPOWER on IntegriCloud