|
|
99be8f |
From 24eec64aa52b65b606d8cc0b03619f3974f12484 Mon Sep 17 00:00:00 2001
|
|
|
99be8f |
From: Andrea Claudi <aclaudi@redhat.com>
|
|
|
99be8f |
Date: Wed, 5 Jun 2019 13:08:41 +0200
|
|
|
99be8f |
Subject: [PATCH] gre/gre6: allow clearing {,i,o}{key,seq,csum} flags
|
|
|
99be8f |
|
|
|
99be8f |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1714660
|
|
|
99be8f |
Upstream Status: iproute2.git commit 7f520601f59ee
|
|
|
99be8f |
Conflicts: context change on ip/link_gre?.c due to missing commit
|
|
|
99be8f |
ae91205c4d2a7 ("gre/gre6: Unify gre_print_help()")
|
|
|
99be8f |
|
|
|
99be8f |
commit 7f520601f59ee35da2fc48b3f1b39ed2b80c9efa
|
|
|
99be8f |
Author: Sabrina Dubroca <sd@queasysnail.net>
|
|
|
99be8f |
Date: Fri Apr 20 10:32:00 2018 +0200
|
|
|
99be8f |
|
|
|
99be8f |
gre/gre6: allow clearing {,i,o}{key,seq,csum} flags
|
|
|
99be8f |
|
|
|
99be8f |
Currently, iproute allows setting those flags, but it's impossible to
|
|
|
99be8f |
clear them, since their current value is fetched from the kernel and
|
|
|
99be8f |
then we OR in the additional flags passed on the command line.
|
|
|
99be8f |
|
|
|
99be8f |
Add no* variants to allow clearing them.
|
|
|
99be8f |
|
|
|
99be8f |
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
|
|
|
99be8f |
Signed-off-by: David Ahern <dsahern@gmail.com>
|
|
|
99be8f |
---
|
|
|
99be8f |
ip/link_gre.c | 30 +++++++++++++++++++++++++++---
|
|
|
99be8f |
ip/link_gre6.c | 30 +++++++++++++++++++++++++++---
|
|
|
99be8f |
man/man8/ip-link.8.in | 27 ++++++++++++++++++---------
|
|
|
99be8f |
3 files changed, 72 insertions(+), 15 deletions(-)
|
|
|
99be8f |
|
|
|
99be8f |
diff --git a/ip/link_gre.c b/ip/link_gre.c
|
|
|
99be8f |
index 1376d2e3af7de..41e2edbedb6eb 100644
|
|
|
99be8f |
--- a/ip/link_gre.c
|
|
|
99be8f |
+++ b/ip/link_gre.c
|
|
|
99be8f |
@@ -28,9 +28,9 @@ static void print_usage(FILE *f)
|
|
|
99be8f |
fprintf(f,
|
|
|
99be8f |
"Usage: ... { gre | gretap } [ remote ADDR ]\n"
|
|
|
99be8f |
" [ local ADDR ]\n"
|
|
|
99be8f |
- " [ [i|o]seq ]\n"
|
|
|
99be8f |
- " [ [i|o]key KEY ]\n"
|
|
|
99be8f |
- " [ [i|o]csum ]\n"
|
|
|
99be8f |
+ " [ [no][i|o]seq ]\n"
|
|
|
99be8f |
+ " [ [i|o]key KEY | no[i|o]key ]\n"
|
|
|
99be8f |
+ " [ [no][i|o]csum ]\n"
|
|
|
99be8f |
" [ ttl TTL ]\n"
|
|
|
99be8f |
" [ tos TOS ]\n"
|
|
|
99be8f |
" [ [no]pmtudisc ]\n"
|
|
|
99be8f |
@@ -171,28 +171,52 @@ get_failed:
|
|
|
99be8f |
iflags |= GRE_KEY;
|
|
|
99be8f |
oflags |= GRE_KEY;
|
|
|
99be8f |
ikey = okey = tnl_parse_key("key", *argv);
|
|
|
99be8f |
+ } else if (!matches(*argv, "nokey")) {
|
|
|
99be8f |
+ iflags &= ~GRE_KEY;
|
|
|
99be8f |
+ oflags &= ~GRE_KEY;
|
|
|
99be8f |
+ ikey = okey = 0;
|
|
|
99be8f |
} else if (!matches(*argv, "ikey")) {
|
|
|
99be8f |
NEXT_ARG();
|
|
|
99be8f |
iflags |= GRE_KEY;
|
|
|
99be8f |
ikey = tnl_parse_key("ikey", *argv);
|
|
|
99be8f |
+ } else if (!matches(*argv, "noikey")) {
|
|
|
99be8f |
+ iflags &= ~GRE_KEY;
|
|
|
99be8f |
+ ikey = 0;
|
|
|
99be8f |
} else if (!matches(*argv, "okey")) {
|
|
|
99be8f |
NEXT_ARG();
|
|
|
99be8f |
oflags |= GRE_KEY;
|
|
|
99be8f |
okey = tnl_parse_key("okey", *argv);
|
|
|
99be8f |
+ } else if (!matches(*argv, "nookey")) {
|
|
|
99be8f |
+ oflags &= ~GRE_KEY;
|
|
|
99be8f |
+ okey = 0;
|
|
|
99be8f |
} else if (!matches(*argv, "seq")) {
|
|
|
99be8f |
iflags |= GRE_SEQ;
|
|
|
99be8f |
oflags |= GRE_SEQ;
|
|
|
99be8f |
+ } else if (!matches(*argv, "noseq")) {
|
|
|
99be8f |
+ iflags &= ~GRE_SEQ;
|
|
|
99be8f |
+ oflags &= ~GRE_SEQ;
|
|
|
99be8f |
} else if (!matches(*argv, "iseq")) {
|
|
|
99be8f |
iflags |= GRE_SEQ;
|
|
|
99be8f |
+ } else if (!matches(*argv, "noiseq")) {
|
|
|
99be8f |
+ iflags &= ~GRE_SEQ;
|
|
|
99be8f |
} else if (!matches(*argv, "oseq")) {
|
|
|
99be8f |
oflags |= GRE_SEQ;
|
|
|
99be8f |
+ } else if (!matches(*argv, "nooseq")) {
|
|
|
99be8f |
+ oflags &= ~GRE_SEQ;
|
|
|
99be8f |
} else if (!matches(*argv, "csum")) {
|
|
|
99be8f |
iflags |= GRE_CSUM;
|
|
|
99be8f |
oflags |= GRE_CSUM;
|
|
|
99be8f |
+ } else if (!matches(*argv, "nocsum")) {
|
|
|
99be8f |
+ iflags &= ~GRE_CSUM;
|
|
|
99be8f |
+ oflags &= ~GRE_CSUM;
|
|
|
99be8f |
} else if (!matches(*argv, "icsum")) {
|
|
|
99be8f |
iflags |= GRE_CSUM;
|
|
|
99be8f |
+ } else if (!matches(*argv, "noicsum")) {
|
|
|
99be8f |
+ iflags &= ~GRE_CSUM;
|
|
|
99be8f |
} else if (!matches(*argv, "ocsum")) {
|
|
|
99be8f |
oflags |= GRE_CSUM;
|
|
|
99be8f |
+ } else if (!matches(*argv, "noocsum")) {
|
|
|
99be8f |
+ oflags &= ~GRE_CSUM;
|
|
|
99be8f |
} else if (!matches(*argv, "nopmtudisc")) {
|
|
|
99be8f |
pmtudisc = 0;
|
|
|
99be8f |
} else if (!matches(*argv, "pmtudisc")) {
|
|
|
99be8f |
diff --git a/ip/link_gre6.c b/ip/link_gre6.c
|
|
|
99be8f |
index 22e6e44aae29b..127e51de4ab73 100644
|
|
|
99be8f |
--- a/ip/link_gre6.c
|
|
|
99be8f |
+++ b/ip/link_gre6.c
|
|
|
99be8f |
@@ -35,9 +35,9 @@ static void print_usage(FILE *f)
|
|
|
99be8f |
fprintf(f,
|
|
|
99be8f |
"Usage: ... { ip6gre | ip6gretap } [ remote ADDR ]\n"
|
|
|
99be8f |
" [ local ADDR ]\n"
|
|
|
99be8f |
- " [ [i|o]seq ]\n"
|
|
|
99be8f |
- " [ [i|o]key KEY ]\n"
|
|
|
99be8f |
- " [ [i|o]csum ]\n"
|
|
|
99be8f |
+ " [ [no][i|o]seq ]\n"
|
|
|
99be8f |
+ " [ [i|o]key KEY | no[i|o]key ]\n"
|
|
|
99be8f |
+ " [ [no][i|o]csum ]\n"
|
|
|
99be8f |
" [ hoplimit TTL ]\n"
|
|
|
99be8f |
" [ encaplimit ELIM ]\n"
|
|
|
99be8f |
" [ tclass TCLASS ]\n"
|
|
|
99be8f |
@@ -185,28 +185,52 @@ get_failed:
|
|
|
99be8f |
iflags |= GRE_KEY;
|
|
|
99be8f |
oflags |= GRE_KEY;
|
|
|
99be8f |
ikey = okey = tnl_parse_key("key", *argv);
|
|
|
99be8f |
+ } else if (!matches(*argv, "nokey")) {
|
|
|
99be8f |
+ iflags &= ~GRE_KEY;
|
|
|
99be8f |
+ oflags &= ~GRE_KEY;
|
|
|
99be8f |
+ ikey = okey = 0;
|
|
|
99be8f |
} else if (!matches(*argv, "ikey")) {
|
|
|
99be8f |
NEXT_ARG();
|
|
|
99be8f |
iflags |= GRE_KEY;
|
|
|
99be8f |
ikey = tnl_parse_key("ikey", *argv);
|
|
|
99be8f |
+ } else if (!matches(*argv, "noikey")) {
|
|
|
99be8f |
+ iflags &= ~GRE_KEY;
|
|
|
99be8f |
+ ikey = 0;
|
|
|
99be8f |
} else if (!matches(*argv, "okey")) {
|
|
|
99be8f |
NEXT_ARG();
|
|
|
99be8f |
oflags |= GRE_KEY;
|
|
|
99be8f |
okey = tnl_parse_key("okey", *argv);
|
|
|
99be8f |
+ } else if (!matches(*argv, "nookey")) {
|
|
|
99be8f |
+ oflags &= ~GRE_KEY;
|
|
|
99be8f |
+ okey = 0;
|
|
|
99be8f |
} else if (!matches(*argv, "seq")) {
|
|
|
99be8f |
iflags |= GRE_SEQ;
|
|
|
99be8f |
oflags |= GRE_SEQ;
|
|
|
99be8f |
+ } else if (!matches(*argv, "noseq")) {
|
|
|
99be8f |
+ iflags &= ~GRE_SEQ;
|
|
|
99be8f |
+ oflags &= ~GRE_SEQ;
|
|
|
99be8f |
} else if (!matches(*argv, "iseq")) {
|
|
|
99be8f |
iflags |= GRE_SEQ;
|
|
|
99be8f |
+ } else if (!matches(*argv, "noiseq")) {
|
|
|
99be8f |
+ iflags &= ~GRE_SEQ;
|
|
|
99be8f |
} else if (!matches(*argv, "oseq")) {
|
|
|
99be8f |
oflags |= GRE_SEQ;
|
|
|
99be8f |
+ } else if (!matches(*argv, "nooseq")) {
|
|
|
99be8f |
+ oflags &= ~GRE_SEQ;
|
|
|
99be8f |
} else if (!matches(*argv, "csum")) {
|
|
|
99be8f |
iflags |= GRE_CSUM;
|
|
|
99be8f |
oflags |= GRE_CSUM;
|
|
|
99be8f |
+ } else if (!matches(*argv, "nocsum")) {
|
|
|
99be8f |
+ iflags &= ~GRE_CSUM;
|
|
|
99be8f |
+ oflags &= ~GRE_CSUM;
|
|
|
99be8f |
} else if (!matches(*argv, "icsum")) {
|
|
|
99be8f |
iflags |= GRE_CSUM;
|
|
|
99be8f |
+ } else if (!matches(*argv, "noicsum")) {
|
|
|
99be8f |
+ iflags &= ~GRE_CSUM;
|
|
|
99be8f |
} else if (!matches(*argv, "ocsum")) {
|
|
|
99be8f |
oflags |= GRE_CSUM;
|
|
|
99be8f |
+ } else if (!matches(*argv, "noocsum")) {
|
|
|
99be8f |
+ oflags &= ~GRE_CSUM;
|
|
|
99be8f |
} else if (!matches(*argv, "remote")) {
|
|
|
99be8f |
inet_prefix addr;
|
|
|
99be8f |
|
|
|
99be8f |
diff --git a/man/man8/ip-link.8.in b/man/man8/ip-link.8.in
|
|
|
99be8f |
index cfea1bdfdc030..8be5d5e1e9fd6 100644
|
|
|
99be8f |
--- a/man/man8/ip-link.8.in
|
|
|
99be8f |
+++ b/man/man8/ip-link.8.in
|
|
|
99be8f |
@@ -708,12 +708,14 @@ the following additional arguments are supported:
|
|
|
99be8f |
.BR type " { " gre " | " gretap " }"
|
|
|
99be8f |
.BI " remote " ADDR " local " ADDR
|
|
|
99be8f |
[
|
|
|
99be8f |
-.RB [ i | o ] seq
|
|
|
99be8f |
+.RB [ no ] "" [ i | o ] seq
|
|
|
99be8f |
] [
|
|
|
99be8f |
.RB [ i | o ] key
|
|
|
99be8f |
.I KEY
|
|
|
99be8f |
+|
|
|
|
99be8f |
+.BR no [ i | o ] key
|
|
|
99be8f |
] [
|
|
|
99be8f |
-.RB [ i | o ] csum
|
|
|
99be8f |
+.RB [ no ] "" [ i | o ] csum
|
|
|
99be8f |
] [
|
|
|
99be8f |
.BI ttl " TTL "
|
|
|
99be8f |
] [
|
|
|
99be8f |
@@ -749,7 +751,7 @@ the following additional arguments are supported:
|
|
|
99be8f |
It must be an address on another interface on this host.
|
|
|
99be8f |
|
|
|
99be8f |
.sp
|
|
|
99be8f |
-.RB [ i | o ] seq
|
|
|
99be8f |
+.RB [ no ] "" [ i | o ] seq
|
|
|
99be8f |
- serialize packets.
|
|
|
99be8f |
The
|
|
|
99be8f |
.B oseq
|
|
|
99be8f |
@@ -761,6 +763,8 @@ flag requires that all input packets are serialized.
|
|
|
99be8f |
.sp
|
|
|
99be8f |
.RB [ i | o ] key
|
|
|
99be8f |
.I KEY
|
|
|
99be8f |
+|
|
|
|
99be8f |
+.BR no [ i | o ] key
|
|
|
99be8f |
- use keyed GRE with key
|
|
|
99be8f |
.IR KEY ". "KEY
|
|
|
99be8f |
is either a number or an IPv4 address-like dotted quad.
|
|
|
99be8f |
@@ -772,7 +776,7 @@ The
|
|
|
99be8f |
parameters specify different keys for input and output.
|
|
|
99be8f |
|
|
|
99be8f |
.sp
|
|
|
99be8f |
-.RB [ i | o ] csum
|
|
|
99be8f |
+.RB [ no ] "" [ i | o ] csum
|
|
|
99be8f |
- generate/require checksums for tunneled packets.
|
|
|
99be8f |
The
|
|
|
99be8f |
.B ocsum
|
|
|
99be8f |
@@ -853,12 +857,14 @@ the following additional arguments are supported:
|
|
|
99be8f |
.BR type " { " ip6gre " | " ip6gretap " }"
|
|
|
99be8f |
.BI remote " ADDR " local " ADDR"
|
|
|
99be8f |
[
|
|
|
99be8f |
-.RB [ i | o ] seq
|
|
|
99be8f |
+.RB [ no ] "" [ i | o ] seq
|
|
|
99be8f |
] [
|
|
|
99be8f |
.RB [ i | o ] key
|
|
|
99be8f |
.I KEY
|
|
|
99be8f |
+|
|
|
|
99be8f |
+.BR no [ i | o ] key
|
|
|
99be8f |
] [
|
|
|
99be8f |
-.RB [ i | o ] csum
|
|
|
99be8f |
+.RB [ no ] "" [ i | o ] csum
|
|
|
99be8f |
] [
|
|
|
99be8f |
.BI hoplimit " TTL "
|
|
|
99be8f |
] [
|
|
|
99be8f |
@@ -884,7 +890,7 @@ the following additional arguments are supported:
|
|
|
99be8f |
It must be an address on another interface on this host.
|
|
|
99be8f |
|
|
|
99be8f |
.sp
|
|
|
99be8f |
-.RB [ i | o ] seq
|
|
|
99be8f |
+.RB [ no ] "" [ i | o ] seq
|
|
|
99be8f |
- serialize packets.
|
|
|
99be8f |
The
|
|
|
99be8f |
.B oseq
|
|
|
99be8f |
@@ -894,7 +900,10 @@ The
|
|
|
99be8f |
flag requires that all input packets are serialized.
|
|
|
99be8f |
|
|
|
99be8f |
.sp
|
|
|
99be8f |
-.RB [ i | o ] key " \fIKEY"
|
|
|
99be8f |
+.RB [ i | o ] key
|
|
|
99be8f |
+.I KEY
|
|
|
99be8f |
+|
|
|
|
99be8f |
+.BR no [ i | o ] key
|
|
|
99be8f |
- use keyed GRE with key
|
|
|
99be8f |
.IR KEY ". "KEY
|
|
|
99be8f |
is either a number or an IPv4 address-like dotted quad.
|
|
|
99be8f |
@@ -906,7 +915,7 @@ The
|
|
|
99be8f |
parameters specify different keys for input and output.
|
|
|
99be8f |
|
|
|
99be8f |
.sp
|
|
|
99be8f |
-.RB [ i | o ] csum
|
|
|
99be8f |
+.RB [ no ] "" [ i | o ] csum
|
|
|
99be8f |
- generate/require checksums for tunneled packets.
|
|
|
99be8f |
The
|
|
|
99be8f |
.B ocsum
|
|
|
99be8f |
--
|
|
|
99be8f |
2.20.1
|
|
|
99be8f |
|