]> git.proxmox.com Git - mirror_iproute2.git/blobdiff - ip/link_gre.c
bridge: fdb: add support for src_vni option
[mirror_iproute2.git] / ip / link_gre.c
index bc1cee8fbca2ab0c811c99c431fbc753bec7d52d..d754fa9a3425fa89e992b53e571b12c243147a18 100644 (file)
@@ -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")) {
@@ -371,9 +395,9 @@ get_failed:
        addattr32(n, 1024, IFLA_GRE_OKEY, okey);
        addattr_l(n, 1024, IFLA_GRE_IFLAGS, &iflags, 2);
        addattr_l(n, 1024, IFLA_GRE_OFLAGS, &oflags, 2);
-       if (is_addrtype_inet(&saddr))
+       if (is_addrtype_inet_not_unspec(&saddr))
                addattr_l(n, 1024, IFLA_GRE_LOCAL, saddr.data, saddr.bytelen);
-       if (is_addrtype_inet(&daddr))
+       if (is_addrtype_inet_not_unspec(&daddr))
                addattr_l(n, 1024, IFLA_GRE_REMOTE, daddr.data, daddr.bytelen);
        addattr_l(n, 1024, IFLA_GRE_PMTUDISC, &pmtudisc, 1);
        if (ignore_df)
@@ -439,7 +463,7 @@ static void gre_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
                tos = rta_getattr_u8(tb[IFLA_GRE_TOS]);
        if (tos) {
                if (is_json_context() || tos != 1)
-                       print_0xhex(PRINT_ANY, "tos", "tos 0x%x ", tos);
+                       print_0xhex(PRINT_ANY, "tos", "tos %#llx ", tos);
                else
                        print_string(PRINT_FP, NULL, "tos %s ", "inherit");
        }
@@ -484,7 +508,7 @@ static void gre_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
 
                if (fwmark) {
                        print_0xhex(PRINT_ANY,
-                                   "fwmark", "fwmark 0x%x ", fwmark);
+                                   "fwmark", "fwmark %#llx ", fwmark);
                }
        }
 
@@ -517,7 +541,7 @@ static void gre_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
                __u16 erspan_hwid = rta_getattr_u16(tb[IFLA_GRE_ERSPAN_HWID]);
 
                print_0xhex(PRINT_ANY,
-                           "erspan_hwid", "erspan_hwid 0x%x ", erspan_hwid);
+                           "erspan_hwid", "erspan_hwid %#llx ", erspan_hwid);
        }
 
        tnl_print_encap(tb,