naccyde / rpms / iproute

Forked from rpms/iproute 5 months ago
Clone

Blame SOURCES/0165-geneve-add-support-for-IPv6-link-partners.patch

049c96
From 0d9e19857745be8b49d5bca762bf4bdeaa977b08 Mon Sep 17 00:00:00 2001
049c96
From: Phil Sutter <psutter@redhat.com>
049c96
Date: Sat, 2 Jul 2016 12:46:03 +0200
049c96
Subject: [PATCH] geneve: add support for IPv6 link partners
049c96
049c96
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1339178
049c96
Upstream Status: iproute2.git commit 906ac5437ab8e
049c96
049c96
commit 906ac5437ab8e1e5f8514afe62bf01e1ff3906af
049c96
Author: John W. Linville <linville@tuxdriver.com>
049c96
Date:   Thu Sep 24 14:39:39 2015 -0400
049c96
049c96
    geneve: add support for IPv6 link partners
049c96
049c96
    Signed-off-by: John W. Linville <linville@tuxdriver.com>
049c96
---
049c96
 ip/iplink_geneve.c | 20 +++++++++++++-------
049c96
 1 file changed, 13 insertions(+), 7 deletions(-)
049c96
049c96
diff --git a/ip/iplink_geneve.c b/ip/iplink_geneve.c
049c96
index 331240a..1345479 100644
049c96
--- a/ip/iplink_geneve.c
049c96
+++ b/ip/iplink_geneve.c
049c96
@@ -55,7 +55,7 @@ static int geneve_parse_opt(struct link_util *lu, int argc, char **argv,
049c96
 				fprintf(stderr, "Invalid address \"%s\"\n", *argv);
049c96
 				return -1;
049c96
 			}
049c96
-			if (IN_MULTICAST(ntohl(daddr)))
049c96
+			if (IN6_IS_ADDR_MULTICAST(&daddr6) || IN_MULTICAST(ntohl(daddr)))
049c96
 				invarg("invalid remote address", *argv);
049c96
 		} else if (!matches(*argv, "ttl") ||
049c96
 			   !matches(*argv, "hoplimit")) {
049c96
@@ -96,18 +96,16 @@ static int geneve_parse_opt(struct link_util *lu, int argc, char **argv,
049c96
 		return -1;
049c96
 	}
049c96
 
049c96
-	if (!daddr) {
049c96
-		fprintf(stderr, "geneve: remove link partner not specified\n");
049c96
-		return -1;
049c96
-	}
049c96
-	if (memcmp(&daddr6, &in6addr_any, sizeof(daddr6)) != 0) {
049c96
-		fprintf(stderr, "geneve: remove link over IPv6 not supported\n");
049c96
+	if (!daddr && memcmp(&daddr6, &in6addr_any, sizeof(daddr6)) == 0) {
049c96
+		fprintf(stderr, "geneve: remote link partner not specified\n");
049c96
 		return -1;
049c96
 	}
049c96
 
049c96
 	addattr32(n, 1024, IFLA_GENEVE_ID, vni);
049c96
 	if (daddr)
049c96
 		addattr_l(n, 1024, IFLA_GENEVE_REMOTE, &daddr, 4);
049c96
+	if (memcmp(&daddr6, &in6addr_any, sizeof(daddr6)) != 0)
049c96
+		addattr_l(n, 1024, IFLA_GENEVE_REMOTE6, &daddr6, sizeof(struct in6_addr));
049c96
 	addattr8(n, 1024, IFLA_GENEVE_TTL, ttl);
049c96
 	addattr8(n, 1024, IFLA_GENEVE_TOS, tos);
049c96
 
049c96
@@ -135,6 +133,14 @@ static void geneve_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
049c96
 		if (addr)
049c96
 			fprintf(f, "remote %s ",
049c96
 				format_host(AF_INET, 4, &addr, s1, sizeof(s1)));
049c96
+	} else if (tb[IFLA_GENEVE_REMOTE6]) {
049c96
+		struct in6_addr addr;
049c96
+		memcpy(&addr, RTA_DATA(tb[IFLA_GENEVE_REMOTE6]), sizeof(struct in6_addr));
049c96
+		if (memcmp(&addr, &in6addr_any, sizeof(addr)) != 0) {
049c96
+			if (IN6_IS_ADDR_MULTICAST(&addr))
049c96
+				fprintf(f, "remote %s ",
049c96
+					format_host(AF_INET6, sizeof(struct in6_addr), &addr, s1, sizeof(s1)));
049c96
+		}
049c96
 	}
049c96
 
049c96
 	if (tb[IFLA_GENEVE_TTL]) {
049c96
-- 
049c96
1.8.3.1
049c96