diff mbox series

[iproute2-next] ip/geneve: add support for IFLA_GENEVE_INNER_PROTO_INHERIT

Message ID 20220319085740.1833561-1-eyal.birger@gmail.com (mailing list archive)
State Accepted
Delegated to: David Ahern
Headers show
Series [iproute2-next] ip/geneve: add support for IFLA_GENEVE_INNER_PROTO_INHERIT | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Eyal Birger March 19, 2022, 8:57 a.m. UTC
Add support for creating devices with this property.
Since it cannot be changed, not adding a [no] option.

Signed-off-by: Eyal Birger <eyal.birger@gmail.com>
---
 include/uapi/linux/if_link.h |  1 +
 ip/iplink_geneve.c           | 13 +++++++++++++
 man/man8/ip-link.8.in        |  6 ++++++
 3 files changed, 20 insertions(+)

Comments

David Ahern March 20, 2022, 11:56 p.m. UTC | #1
On 3/19/22 2:57 AM, Eyal Birger wrote:
> @@ -182,6 +184,10 @@ static int geneve_parse_opt(struct link_util *lu, int argc, char **argv,
>  			check_duparg(&attrs, IFLA_GENEVE_UDP_ZERO_CSUM6_RX,
>  				     *argv, *argv);
>  			udp6zerocsumrx = 0;
> +		} else if (!matches(*argv, "innerprotoinherit")) {

changed matches to strcmp (not taking any more usage of matches) and
applied to iproute2-next.
diff mbox series

Patch

diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index 5f36ff8e..8d2f23d3 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -840,6 +840,7 @@  enum {
 	IFLA_GENEVE_LABEL,
 	IFLA_GENEVE_TTL_INHERIT,
 	IFLA_GENEVE_DF,
+	IFLA_GENEVE_INNER_PROTO_INHERIT,
 	__IFLA_GENEVE_MAX
 };
 #define IFLA_GENEVE_MAX	(__IFLA_GENEVE_MAX - 1)
diff --git a/ip/iplink_geneve.c b/ip/iplink_geneve.c
index 78fc818e..a0d3ed61 100644
--- a/ip/iplink_geneve.c
+++ b/ip/iplink_geneve.c
@@ -31,6 +31,7 @@  static void print_explain(FILE *f)
 		"		[ [no]udpcsum ]\n"
 		"		[ [no]udp6zerocsumtx ]\n"
 		"		[ [no]udp6zerocsumrx ]\n"
+		"		[ innerprotoinherit ]\n"
 		"\n"
 		"Where:	VNI   := 0-16777215\n"
 		"	ADDR  := IP_ADDRESS\n"
@@ -72,6 +73,7 @@  static int geneve_parse_opt(struct link_util *lu, int argc, char **argv,
 	__u64 attrs = 0;
 	bool set_op = (n->nlmsg_type == RTM_NEWLINK &&
 		       !(n->nlmsg_flags & NLM_F_CREATE));
+	bool inner_proto_inherit = false;
 
 	inet_prefix_reset(&daddr);
 
@@ -182,6 +184,10 @@  static int geneve_parse_opt(struct link_util *lu, int argc, char **argv,
 			check_duparg(&attrs, IFLA_GENEVE_UDP_ZERO_CSUM6_RX,
 				     *argv, *argv);
 			udp6zerocsumrx = 0;
+		} else if (!matches(*argv, "innerprotoinherit")) {
+			check_duparg(&attrs, IFLA_GENEVE_INNER_PROTO_INHERIT,
+				     *argv, *argv);
+			inner_proto_inherit = true;
 		} else if (matches(*argv, "help") == 0) {
 			explain();
 			return -1;
@@ -231,6 +237,8 @@  static int geneve_parse_opt(struct link_util *lu, int argc, char **argv,
 		addattr16(n, 1024, IFLA_GENEVE_PORT, htons(dstport));
 	if (metadata)
 		addattr(n, 1024, IFLA_GENEVE_COLLECT_METADATA);
+	if (inner_proto_inherit)
+		addattr(n, 1024, IFLA_GENEVE_INNER_PROTO_INHERIT);
 	if (GENEVE_ATTRSET(attrs, IFLA_GENEVE_UDP_CSUM))
 		addattr8(n, 1024, IFLA_GENEVE_UDP_CSUM, udpcsum);
 	if (GENEVE_ATTRSET(attrs, IFLA_GENEVE_UDP_ZERO_CSUM6_TX))
@@ -365,6 +373,11 @@  static void geneve_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
 			fputs("udp6zerocsumrx ", f);
 		}
 	}
+
+	if (tb[IFLA_GENEVE_INNER_PROTO_INHERIT]) {
+		print_bool(PRINT_ANY, "inner_proto_inherit",
+			   "innerprotoinherit ", true);
+	}
 }
 
 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 93106d7f..5713a872 100644
--- a/man/man8/ip-link.8.in
+++ b/man/man8/ip-link.8.in
@@ -1255,6 +1255,8 @@  the following additional arguments are supported:
 .RB [ no ] udp6zerocsumtx
 ] [
 .RB [ no ] udp6zerocsumrx
+] [
+.B innerprotoinherit
 ]
 
 .in +8
@@ -1318,6 +1320,10 @@  options.
 .RB [ no ] udp6zerocsumrx
 - allow incoming UDP packets over IPv6 with zero checksum field.
 
+.sp
+.B innerprotoinherit
+- use IPv4/IPv6 as inner protocol instead of Ethernet.
+
 .in -8
 
 .TP