Blame SOURCES/iproute2-3.10.0-Add-destination-port-support-for-VXLAN.patch

7787e2
From 31996f4f78d5532447ef5144fc19e4c046f174b5 Mon Sep 17 00:00:00 2001
7787e2
From: =?UTF-8?q?Petr=20=C5=A0abata?= <contyk@redhat.com>
7787e2
Date: Tue, 25 Feb 2014 16:30:45 +0100
7787e2
Subject: [PATCH 1/2] Add destination port support for VXLAN
7787e2
MIME-Version: 1.0
7787e2
Content-Type: text/plain; charset=UTF-8
7787e2
Content-Transfer-Encoding: 8bit
7787e2
7787e2
Signed-off-by: Petr Ĺ abata <contyk@redhat.com>
7787e2
---
7787e2
 ip/iplink_vxlan.c     | 29 +++++++++++++++++++++++------
7787e2
 man/man8/ip-link.8.in | 15 +++++++++++++--
7787e2
 2 files changed, 36 insertions(+), 8 deletions(-)
7787e2
7787e2
diff --git a/ip/iplink_vxlan.c b/ip/iplink_vxlan.c
7787e2
index 3450135..fdae6b1 100644
7787e2
--- a/ip/iplink_vxlan.c
7787e2
+++ b/ip/iplink_vxlan.c
7787e2
@@ -23,7 +23,7 @@
7787e2
 
7787e2
 static void explain(void)
7787e2
 {
7787e2
-	fprintf(stderr, "Usage: ... vxlan id VNI [ group ADDR ] [ local ADDR ]\n");
7787e2
+	fprintf(stderr, "Usage: ... vxlan id VNI [ { group | remote } ADDR ] [ local ADDR ]\n");
7787e2
 	fprintf(stderr, "                 [ ttl TTL ] [ tos TOS ] [ dev PHYS_DEV ]\n");
7787e2
 	fprintf(stderr, "                 [ dstport PORT ] [ srcport MIN MAX ]\n");
7787e2
 	fprintf(stderr, "                 [ [no]learning ] [ [no]proxy ] [ [no]rsc ]\n");
7787e2
@@ -42,6 +42,7 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
7787e2
 	int vni_set = 0;
7787e2
 	__u32 saddr = 0;
7787e2
 	__u32 gaddr = 0;
7787e2
+	__u32 daddr = 0;
7787e2
 	unsigned link = 0;
7787e2
 	__u8 tos = 0;
7787e2
 	__u8 ttl = 0;
7787e2
@@ -70,7 +71,13 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
7787e2
 			gaddr = get_addr32(*argv);
7787e2
 
7787e2
 			if (!IN_MULTICAST(ntohl(gaddr)))
7787e2
-				invarg("invald group address", *argv);
7787e2
+				invarg("invalid group address", *argv);
7787e2
+		} else if (!matches(*argv, "remote")) {
7787e2
+			NEXT_ARG();
7787e2
+			daddr = get_addr32(*argv);
7787e2
+
7787e2
+			if (IN_MULTICAST(ntohl(daddr)))
7787e2
+				invarg("invalid remote address", *argv);
7787e2
 		} else if (!matches(*argv, "local")) {
7787e2
 			NEXT_ARG();
7787e2
 			if (strcmp(*argv, "any"))
7787e2
@@ -176,10 +183,15 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
7787e2
 			"Use 'dstport 4789' to get the IANA assigned value\n"
7787e2
 			"Use 'dstport 0' to get default and quiet this message\n");
7787e2
 	}
7787e2
-
7787e2
+	if (gaddr && daddr) {
7787e2
+		fprintf(stderr, "vxlan: both group and remote cannot be specified\n");
7787e2
+		return -1;
7787e2
+	}
7787e2
 	addattr32(n, 1024, IFLA_VXLAN_ID, vni);
7787e2
 	if (gaddr)
7787e2
 		addattr_l(n, 1024, IFLA_VXLAN_GROUP, &gaddr, 4);
7787e2
+	else if (daddr)
7787e2
+		addattr_l(n, 1024, IFLA_VXLAN_GROUP, &daddr, 4);
7787e2
 	if (saddr)
7787e2
 		addattr_l(n, 1024, IFLA_VXLAN_LOCAL, &saddr, 4);
7787e2
 	if (link)
7787e2
@@ -228,9 +240,14 @@ static void vxlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
7787e2
 
7787e2
 	if (tb[IFLA_VXLAN_GROUP]) {
7787e2
 		__be32 addr = rta_getattr_u32(tb[IFLA_VXLAN_GROUP]);
7787e2
-		if (addr)
7787e2
-			fprintf(f, "group %s ",
7787e2
-				format_host(AF_INET, 4, &addr, s1, sizeof(s1)));
7787e2
+		if (addr) {
7787e2
+			if (IN_MULTICAST(ntohl(addr)))
7787e2
+				fprintf(f, "group %s ",
7787e2
+					format_host(AF_INET, 4, &addr, s1, sizeof(s1)));
7787e2
+			else
7787e2
+				fprintf(f, "remote %s ",
7787e2
+					format_host(AF_INET, 4, &addr, s1, sizeof(s1)));
7787e2
+		}
7787e2
 	}
7787e2
 
7787e2
 	if (tb[IFLA_VXLAN_LOCAL]) {
7787e2
diff --git a/man/man8/ip-link.8.in b/man/man8/ip-link.8.in
7787e2
index 9daac71..6a32990 100644
7787e2
--- a/man/man8/ip-link.8.in
7787e2
+++ b/man/man8/ip-link.8.in
7787e2
@@ -265,8 +265,8 @@ the following additional arguments are supported:
7787e2
 .BI type " vxlan " id " ID
7787e2
 .R " [ "
7787e2
 .BI dev " PHYS_DEV "
7787e2
-.R " ] [ "
7787e2
-.BI group " IPADDR "
7787e2
+.RB " ] [ { " group " | " remote " } "
7787e2
+.I IPADDR
7787e2
 .R " ] [ "
7787e2
 .BI local " IPADDR "
7787e2
 .R " ] [ "
7787e2
@@ -299,6 +299,17 @@ Identifier) to use.
7787e2
 .sp
7787e2
 .BI group " IPADDR"
7787e2
 - specifies the multicast IP address to join.
7787e2
+This parameter cannot be specified with the
7787e2
+.B remote
7787e2
+parameter.
7787e2
+
7787e2
+.sp
7787e2
+.BI remote " IPADDR"
7787e2
+- specifies the unicast destination IP address to use in outgoing packets
7787e2
+when the destination link layer address is not known in the VXLAN device
7787e2
+forwarding database.  This parameter cannot be specified with the
7787e2
+.B group
7787e2
+parameter.
7787e2
 
7787e2
 .sp
7787e2
 .BI local " IPADDR"
7787e2
-- 
7787e2
1.8.5.3
7787e2