netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iplink_geneve: add UDP destination port configuration at link creation
@ 2015-09-17 19:27 John W. Linville
  2015-09-17 20:49 ` Eric Dumazet
  2015-09-18 19:59 ` [PATCH] geneve: use network byte order for destination port config parameter John W. Linville
  0 siblings, 2 replies; 12+ messages in thread
From: John W. Linville @ 2015-09-17 19:27 UTC (permalink / raw)
  To: netdev; +Cc: Stephen Hemminger, Pravin B Shelar, John W. Linville

Signed-off-by: John W. Linville <linville@tuxdriver.com>
---
I didn't see an iproute2 patch posted for this option, so here is my version...

 ip/iplink_geneve.c    | 13 +++++++++++++
 man/man8/ip-link.8.in |  6 ++++++
 2 files changed, 19 insertions(+)

diff --git a/ip/iplink_geneve.c b/ip/iplink_geneve.c
index 331240a6a3d9..0a45647844f5 100644
--- a/ip/iplink_geneve.c
+++ b/ip/iplink_geneve.c
@@ -19,6 +19,7 @@ static void print_explain(FILE *f)
 {
 	fprintf(f, "Usage: ... geneve id VNI remote ADDR\n");
 	fprintf(f, "                 [ ttl TTL ] [ tos TOS ]\n");
+	fprintf(f, "                 [ dstport PORT ]\n");
 	fprintf(f, "\n");
 	fprintf(f, "Where: VNI  := 0-16777215\n");
 	fprintf(f, "       ADDR := IP_ADDRESS\n");
@@ -40,6 +41,7 @@ static int geneve_parse_opt(struct link_util *lu, int argc, char **argv,
 	struct in6_addr daddr6 = IN6ADDR_ANY_INIT;
 	__u8 ttl = 0;
 	__u8 tos = 0;
+	__u16 dstport = 0;
 
 	while (argc > 0) {
 		if (!matches(*argv, "id") ||
@@ -80,6 +82,10 @@ static int geneve_parse_opt(struct link_util *lu, int argc, char **argv,
 				tos = uval;
 			} else
 				tos = 1;
+		} else if (!matches(*argv, "dstport")){
+			NEXT_ARG();
+			if (get_u16(&dstport, *argv, 0))
+				invarg("dst port", *argv);
 		} else if (matches(*argv, "help") == 0) {
 			explain();
 			return -1;
@@ -111,6 +117,9 @@ static int geneve_parse_opt(struct link_util *lu, int argc, char **argv,
 	addattr8(n, 1024, IFLA_GENEVE_TTL, ttl);
 	addattr8(n, 1024, IFLA_GENEVE_TOS, tos);
 
+	if (dstport)
+		addattr16(n, 1024, IFLA_GENEVE_PORT, htons(dstport));
+
 	return 0;
 }
 
@@ -150,6 +159,10 @@ static void geneve_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
 		else
 			fprintf(f, "tos %#x ", tos);
 	}
+
+	if (tb[IFLA_GENEVE_PORT])
+		fprintf(f, "dstport %u ",
+			ntohs(rta_getattr_u16(tb[IFLA_GENEVE_PORT])));
 }
 
 static void geneve_print_help(struct link_util *lu, int argc, char **argv,
diff --git a/man/man8/ip-link.8.in b/man/man8/ip-link.8.in
index 1896eb6f185e..2e1889af650e 100644
--- a/man/man8/ip-link.8.in
+++ b/man/man8/ip-link.8.in
@@ -747,6 +747,8 @@ the following additional arguments are supported:
 .BI ttl " TTL "
 .R " ] [ "
 .BI tos " TOS "
+.R " ] [ "
+.BI dstport " PORT "
 .R " ]"
 
 .in +8
@@ -766,6 +768,10 @@ the following additional arguments are supported:
 .BI tos " TOS"
 - specifies the TOS value to use in outgoing packets.
 
+.sp
+.BI dstport " PORT "
+- specifies the UDP destination port to communicate at both ends of the GENEVE tunnel.
+
 .in -8
 
 .SS ip link delete - delete virtual link
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-09-23 22:41 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-17 19:27 [PATCH] iplink_geneve: add UDP destination port configuration at link creation John W. Linville
2015-09-17 20:49 ` Eric Dumazet
2015-09-18 14:26   ` John W. Linville
2015-09-18 14:45     ` Eric Dumazet
2015-09-18 16:15       ` Jesse Gross
2015-09-18 18:39         ` John W. Linville
2015-09-18 19:59 ` [PATCH] geneve: use network byte order for destination port config parameter John W. Linville
2015-09-18 20:14   ` Jesse Gross
2015-09-21 23:24   ` David Miller
2015-09-22 15:25     ` John W. Linville
2015-09-22 17:09       ` [PATCH v2] " John W. Linville
2015-09-23 22:41         ` David Miller

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).