gre/gre6: allow clearing {,i,o}{key,seq,csum} flags
Currently, iproute allows setting those flags, but it's impossible to clear them, since their current value is fetched from the kernel and then we OR in the additional flags passed on the command line. Add no* variants to allow clearing them. Signed-off-by: Sabrina Dubroca <sd@queasysnail.net> Signed-off-by: David Ahern <dsahern@gmail.com>
This commit is contained in:
parent
d21c028cf7
commit
7f520601f5
|
|
@ -31,9 +31,9 @@ static void gre_print_help(struct link_util *lu, int argc, char **argv, FILE *f)
|
||||||
);
|
);
|
||||||
fprintf(f,
|
fprintf(f,
|
||||||
" [ local ADDR ]\n"
|
" [ local ADDR ]\n"
|
||||||
" [ [i|o]seq ]\n"
|
" [ [no][i|o]seq ]\n"
|
||||||
" [ [i|o]key KEY ]\n"
|
" [ [i|o]key KEY | no[i|o]key ]\n"
|
||||||
" [ [i|o]csum ]\n"
|
" [ [no][i|o]csum ]\n"
|
||||||
" [ ttl TTL ]\n"
|
" [ ttl TTL ]\n"
|
||||||
" [ tos TOS ]\n"
|
" [ tos TOS ]\n"
|
||||||
" [ [no]pmtudisc ]\n"
|
" [ [no]pmtudisc ]\n"
|
||||||
|
|
@ -210,28 +210,52 @@ get_failed:
|
||||||
iflags |= GRE_KEY;
|
iflags |= GRE_KEY;
|
||||||
oflags |= GRE_KEY;
|
oflags |= GRE_KEY;
|
||||||
ikey = okey = tnl_parse_key("key", *argv);
|
ikey = okey = tnl_parse_key("key", *argv);
|
||||||
|
} else if (!matches(*argv, "nokey")) {
|
||||||
|
iflags &= ~GRE_KEY;
|
||||||
|
oflags &= ~GRE_KEY;
|
||||||
|
ikey = okey = 0;
|
||||||
} else if (!matches(*argv, "ikey")) {
|
} else if (!matches(*argv, "ikey")) {
|
||||||
NEXT_ARG();
|
NEXT_ARG();
|
||||||
iflags |= GRE_KEY;
|
iflags |= GRE_KEY;
|
||||||
ikey = tnl_parse_key("ikey", *argv);
|
ikey = tnl_parse_key("ikey", *argv);
|
||||||
|
} else if (!matches(*argv, "noikey")) {
|
||||||
|
iflags &= ~GRE_KEY;
|
||||||
|
ikey = 0;
|
||||||
} else if (!matches(*argv, "okey")) {
|
} else if (!matches(*argv, "okey")) {
|
||||||
NEXT_ARG();
|
NEXT_ARG();
|
||||||
oflags |= GRE_KEY;
|
oflags |= GRE_KEY;
|
||||||
okey = tnl_parse_key("okey", *argv);
|
okey = tnl_parse_key("okey", *argv);
|
||||||
|
} else if (!matches(*argv, "nookey")) {
|
||||||
|
oflags &= ~GRE_KEY;
|
||||||
|
okey = 0;
|
||||||
} else if (!matches(*argv, "seq")) {
|
} else if (!matches(*argv, "seq")) {
|
||||||
iflags |= GRE_SEQ;
|
iflags |= GRE_SEQ;
|
||||||
oflags |= GRE_SEQ;
|
oflags |= GRE_SEQ;
|
||||||
|
} else if (!matches(*argv, "noseq")) {
|
||||||
|
iflags &= ~GRE_SEQ;
|
||||||
|
oflags &= ~GRE_SEQ;
|
||||||
} else if (!matches(*argv, "iseq")) {
|
} else if (!matches(*argv, "iseq")) {
|
||||||
iflags |= GRE_SEQ;
|
iflags |= GRE_SEQ;
|
||||||
|
} else if (!matches(*argv, "noiseq")) {
|
||||||
|
iflags &= ~GRE_SEQ;
|
||||||
} else if (!matches(*argv, "oseq")) {
|
} else if (!matches(*argv, "oseq")) {
|
||||||
oflags |= GRE_SEQ;
|
oflags |= GRE_SEQ;
|
||||||
|
} else if (!matches(*argv, "nooseq")) {
|
||||||
|
oflags &= ~GRE_SEQ;
|
||||||
} else if (!matches(*argv, "csum")) {
|
} else if (!matches(*argv, "csum")) {
|
||||||
iflags |= GRE_CSUM;
|
iflags |= GRE_CSUM;
|
||||||
oflags |= GRE_CSUM;
|
oflags |= GRE_CSUM;
|
||||||
|
} else if (!matches(*argv, "nocsum")) {
|
||||||
|
iflags &= ~GRE_CSUM;
|
||||||
|
oflags &= ~GRE_CSUM;
|
||||||
} else if (!matches(*argv, "icsum")) {
|
} else if (!matches(*argv, "icsum")) {
|
||||||
iflags |= GRE_CSUM;
|
iflags |= GRE_CSUM;
|
||||||
|
} else if (!matches(*argv, "noicsum")) {
|
||||||
|
iflags &= ~GRE_CSUM;
|
||||||
} else if (!matches(*argv, "ocsum")) {
|
} else if (!matches(*argv, "ocsum")) {
|
||||||
oflags |= GRE_CSUM;
|
oflags |= GRE_CSUM;
|
||||||
|
} else if (!matches(*argv, "noocsum")) {
|
||||||
|
oflags &= ~GRE_CSUM;
|
||||||
} else if (!matches(*argv, "nopmtudisc")) {
|
} else if (!matches(*argv, "nopmtudisc")) {
|
||||||
pmtudisc = 0;
|
pmtudisc = 0;
|
||||||
} else if (!matches(*argv, "pmtudisc")) {
|
} else if (!matches(*argv, "pmtudisc")) {
|
||||||
|
|
|
||||||
|
|
@ -38,9 +38,9 @@ static void gre_print_help(struct link_util *lu, int argc, char **argv, FILE *f)
|
||||||
);
|
);
|
||||||
fprintf(f,
|
fprintf(f,
|
||||||
" [ local ADDR ]\n"
|
" [ local ADDR ]\n"
|
||||||
" [ [i|o]seq ]\n"
|
" [ [no][i|o]seq ]\n"
|
||||||
" [ [i|o]key KEY ]\n"
|
" [ [i|o]key KEY | no[i|o]key ]\n"
|
||||||
" [ [i|o]csum ]\n"
|
" [ [no][i|o]csum ]\n"
|
||||||
" [ hoplimit TTL ]\n"
|
" [ hoplimit TTL ]\n"
|
||||||
" [ encaplimit ELIM ]\n"
|
" [ encaplimit ELIM ]\n"
|
||||||
" [ tclass TCLASS ]\n"
|
" [ tclass TCLASS ]\n"
|
||||||
|
|
@ -220,28 +220,52 @@ get_failed:
|
||||||
iflags |= GRE_KEY;
|
iflags |= GRE_KEY;
|
||||||
oflags |= GRE_KEY;
|
oflags |= GRE_KEY;
|
||||||
ikey = okey = tnl_parse_key("key", *argv);
|
ikey = okey = tnl_parse_key("key", *argv);
|
||||||
|
} else if (!matches(*argv, "nokey")) {
|
||||||
|
iflags &= ~GRE_KEY;
|
||||||
|
oflags &= ~GRE_KEY;
|
||||||
|
ikey = okey = 0;
|
||||||
} else if (!matches(*argv, "ikey")) {
|
} else if (!matches(*argv, "ikey")) {
|
||||||
NEXT_ARG();
|
NEXT_ARG();
|
||||||
iflags |= GRE_KEY;
|
iflags |= GRE_KEY;
|
||||||
ikey = tnl_parse_key("ikey", *argv);
|
ikey = tnl_parse_key("ikey", *argv);
|
||||||
|
} else if (!matches(*argv, "noikey")) {
|
||||||
|
iflags &= ~GRE_KEY;
|
||||||
|
ikey = 0;
|
||||||
} else if (!matches(*argv, "okey")) {
|
} else if (!matches(*argv, "okey")) {
|
||||||
NEXT_ARG();
|
NEXT_ARG();
|
||||||
oflags |= GRE_KEY;
|
oflags |= GRE_KEY;
|
||||||
okey = tnl_parse_key("okey", *argv);
|
okey = tnl_parse_key("okey", *argv);
|
||||||
|
} else if (!matches(*argv, "nookey")) {
|
||||||
|
oflags &= ~GRE_KEY;
|
||||||
|
okey = 0;
|
||||||
} else if (!matches(*argv, "seq")) {
|
} else if (!matches(*argv, "seq")) {
|
||||||
iflags |= GRE_SEQ;
|
iflags |= GRE_SEQ;
|
||||||
oflags |= GRE_SEQ;
|
oflags |= GRE_SEQ;
|
||||||
|
} else if (!matches(*argv, "noseq")) {
|
||||||
|
iflags &= ~GRE_SEQ;
|
||||||
|
oflags &= ~GRE_SEQ;
|
||||||
} else if (!matches(*argv, "iseq")) {
|
} else if (!matches(*argv, "iseq")) {
|
||||||
iflags |= GRE_SEQ;
|
iflags |= GRE_SEQ;
|
||||||
|
} else if (!matches(*argv, "noiseq")) {
|
||||||
|
iflags &= ~GRE_SEQ;
|
||||||
} else if (!matches(*argv, "oseq")) {
|
} else if (!matches(*argv, "oseq")) {
|
||||||
oflags |= GRE_SEQ;
|
oflags |= GRE_SEQ;
|
||||||
|
} else if (!matches(*argv, "nooseq")) {
|
||||||
|
oflags &= ~GRE_SEQ;
|
||||||
} else if (!matches(*argv, "csum")) {
|
} else if (!matches(*argv, "csum")) {
|
||||||
iflags |= GRE_CSUM;
|
iflags |= GRE_CSUM;
|
||||||
oflags |= GRE_CSUM;
|
oflags |= GRE_CSUM;
|
||||||
|
} else if (!matches(*argv, "nocsum")) {
|
||||||
|
iflags &= ~GRE_CSUM;
|
||||||
|
oflags &= ~GRE_CSUM;
|
||||||
} else if (!matches(*argv, "icsum")) {
|
} else if (!matches(*argv, "icsum")) {
|
||||||
iflags |= GRE_CSUM;
|
iflags |= GRE_CSUM;
|
||||||
|
} else if (!matches(*argv, "noicsum")) {
|
||||||
|
iflags &= ~GRE_CSUM;
|
||||||
} else if (!matches(*argv, "ocsum")) {
|
} else if (!matches(*argv, "ocsum")) {
|
||||||
oflags |= GRE_CSUM;
|
oflags |= GRE_CSUM;
|
||||||
|
} else if (!matches(*argv, "noocsum")) {
|
||||||
|
oflags &= ~GRE_CSUM;
|
||||||
} else if (!matches(*argv, "remote")) {
|
} else if (!matches(*argv, "remote")) {
|
||||||
NEXT_ARG();
|
NEXT_ARG();
|
||||||
get_addr(&daddr, *argv, AF_INET6);
|
get_addr(&daddr, *argv, AF_INET6);
|
||||||
|
|
|
||||||
|
|
@ -775,12 +775,14 @@ the following additional arguments are supported:
|
||||||
.BR type " { " gre " | " gretap " }"
|
.BR type " { " gre " | " gretap " }"
|
||||||
.BI " remote " ADDR " local " ADDR
|
.BI " remote " ADDR " local " ADDR
|
||||||
[
|
[
|
||||||
.RB [ i | o ] seq
|
.RB [ no ] "" [ i | o ] seq
|
||||||
] [
|
] [
|
||||||
.RB [ i | o ] key
|
.RB [ i | o ] key
|
||||||
.I KEY
|
.I KEY
|
||||||
|
|
|
||||||
|
.BR no [ i | o ] key
|
||||||
] [
|
] [
|
||||||
.RB [ i | o ] csum
|
.RB [ no ] "" [ i | o ] csum
|
||||||
] [
|
] [
|
||||||
.BI ttl " TTL "
|
.BI ttl " TTL "
|
||||||
] [
|
] [
|
||||||
|
|
@ -816,7 +818,7 @@ the following additional arguments are supported:
|
||||||
It must be an address on another interface on this host.
|
It must be an address on another interface on this host.
|
||||||
|
|
||||||
.sp
|
.sp
|
||||||
.RB [ i | o ] seq
|
.RB [ no ] "" [ i | o ] seq
|
||||||
- serialize packets.
|
- serialize packets.
|
||||||
The
|
The
|
||||||
.B oseq
|
.B oseq
|
||||||
|
|
@ -828,6 +830,8 @@ flag requires that all input packets are serialized.
|
||||||
.sp
|
.sp
|
||||||
.RB [ i | o ] key
|
.RB [ i | o ] key
|
||||||
.I KEY
|
.I KEY
|
||||||
|
|
|
||||||
|
.BR no [ i | o ] key
|
||||||
- use keyed GRE with key
|
- use keyed GRE with key
|
||||||
.IR KEY ". "KEY
|
.IR KEY ". "KEY
|
||||||
is either a number or an IPv4 address-like dotted quad.
|
is either a number or an IPv4 address-like dotted quad.
|
||||||
|
|
@ -839,7 +843,7 @@ The
|
||||||
parameters specify different keys for input and output.
|
parameters specify different keys for input and output.
|
||||||
|
|
||||||
.sp
|
.sp
|
||||||
.RB [ i | o ] csum
|
.RB [ no ] "" [ i | o ] csum
|
||||||
- generate/require checksums for tunneled packets.
|
- generate/require checksums for tunneled packets.
|
||||||
The
|
The
|
||||||
.B ocsum
|
.B ocsum
|
||||||
|
|
@ -920,12 +924,14 @@ the following additional arguments are supported:
|
||||||
.BR type " { " ip6gre " | " ip6gretap " }"
|
.BR type " { " ip6gre " | " ip6gretap " }"
|
||||||
.BI remote " ADDR " local " ADDR"
|
.BI remote " ADDR " local " ADDR"
|
||||||
[
|
[
|
||||||
.RB [ i | o ] seq
|
.RB [ no ] "" [ i | o ] seq
|
||||||
] [
|
] [
|
||||||
.RB [ i | o ] key
|
.RB [ i | o ] key
|
||||||
.I KEY
|
.I KEY
|
||||||
|
|
|
||||||
|
.BR no [ i | o ] key
|
||||||
] [
|
] [
|
||||||
.RB [ i | o ] csum
|
.RB [ no ] "" [ i | o ] csum
|
||||||
] [
|
] [
|
||||||
.BI hoplimit " TTL "
|
.BI hoplimit " TTL "
|
||||||
] [
|
] [
|
||||||
|
|
@ -955,7 +961,7 @@ the following additional arguments are supported:
|
||||||
It must be an address on another interface on this host.
|
It must be an address on another interface on this host.
|
||||||
|
|
||||||
.sp
|
.sp
|
||||||
.RB [ i | o ] seq
|
.RB [ no ] "" [ i | o ] seq
|
||||||
- serialize packets.
|
- serialize packets.
|
||||||
The
|
The
|
||||||
.B oseq
|
.B oseq
|
||||||
|
|
@ -965,7 +971,10 @@ The
|
||||||
flag requires that all input packets are serialized.
|
flag requires that all input packets are serialized.
|
||||||
|
|
||||||
.sp
|
.sp
|
||||||
.RB [ i | o ] key " \fIKEY"
|
.RB [ i | o ] key
|
||||||
|
.I KEY
|
||||||
|
|
|
||||||
|
.BR no [ i | o ] key
|
||||||
- use keyed GRE with key
|
- use keyed GRE with key
|
||||||
.IR KEY ". "KEY
|
.IR KEY ". "KEY
|
||||||
is either a number or an IPv4 address-like dotted quad.
|
is either a number or an IPv4 address-like dotted quad.
|
||||||
|
|
@ -977,7 +986,7 @@ The
|
||||||
parameters specify different keys for input and output.
|
parameters specify different keys for input and output.
|
||||||
|
|
||||||
.sp
|
.sp
|
||||||
.RB [ i | o ] csum
|
.RB [ no ] "" [ i | o ] csum
|
||||||
- generate/require checksums for tunneled packets.
|
- generate/require checksums for tunneled packets.
|
||||||
The
|
The
|
||||||
.B ocsum
|
.B ocsum
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue