diff options
author | Sabrina Dubroca <sd@queasysnail.net> | 2018-04-20 10:32:00 +0200 |
---|---|---|
committer | David Ahern <dsahern@gmail.com> | 2018-04-23 19:42:58 -0700 |
commit | 7f520601f59ee35da2fc48b3f1b39ed2b80c9efa (patch) | |
tree | 446a01867e273fc5d8c03fc46ee8c804e19a46d9 /ip/link_gre.c | |
parent | d21c028cf74147360c530a4c53063bbe677dbe73 (diff) |
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>
Diffstat (limited to 'ip/link_gre.c')
-rw-r--r-- | ip/link_gre.c | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/ip/link_gre.c b/ip/link_gre.c index bc1cee8f..ede761b2 100644 --- a/ip/link_gre.c +++ b/ip/link_gre.c @@ -31,9 +31,9 @@ static void gre_print_help(struct link_util *lu, int argc, char **argv, FILE *f) ); fprintf(f, " [ local ADDR ]\n" - " [ [i|o]seq ]\n" - " [ [i|o]key KEY ]\n" - " [ [i|o]csum ]\n" + " [ [no][i|o]seq ]\n" + " [ [i|o]key KEY | no[i|o]key ]\n" + " [ [no][i|o]csum ]\n" " [ ttl TTL ]\n" " [ tos TOS ]\n" " [ [no]pmtudisc ]\n" @@ -210,28 +210,52 @@ get_failed: iflags |= GRE_KEY; oflags |= GRE_KEY; 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")) { NEXT_ARG(); iflags |= GRE_KEY; ikey = tnl_parse_key("ikey", *argv); + } else if (!matches(*argv, "noikey")) { + iflags &= ~GRE_KEY; + ikey = 0; } else if (!matches(*argv, "okey")) { NEXT_ARG(); oflags |= GRE_KEY; okey = tnl_parse_key("okey", *argv); + } else if (!matches(*argv, "nookey")) { + oflags &= ~GRE_KEY; + okey = 0; } else if (!matches(*argv, "seq")) { iflags |= GRE_SEQ; oflags |= GRE_SEQ; + } else if (!matches(*argv, "noseq")) { + iflags &= ~GRE_SEQ; + oflags &= ~GRE_SEQ; } else if (!matches(*argv, "iseq")) { iflags |= GRE_SEQ; + } else if (!matches(*argv, "noiseq")) { + iflags &= ~GRE_SEQ; } else if (!matches(*argv, "oseq")) { oflags |= GRE_SEQ; + } else if (!matches(*argv, "nooseq")) { + oflags &= ~GRE_SEQ; } else if (!matches(*argv, "csum")) { iflags |= GRE_CSUM; oflags |= GRE_CSUM; + } else if (!matches(*argv, "nocsum")) { + iflags &= ~GRE_CSUM; + oflags &= ~GRE_CSUM; } else if (!matches(*argv, "icsum")) { iflags |= GRE_CSUM; + } else if (!matches(*argv, "noicsum")) { + iflags &= ~GRE_CSUM; } else if (!matches(*argv, "ocsum")) { oflags |= GRE_CSUM; + } else if (!matches(*argv, "noocsum")) { + oflags &= ~GRE_CSUM; } else if (!matches(*argv, "nopmtudisc")) { pmtudisc = 0; } else if (!matches(*argv, "pmtudisc")) { |