]> granicus.if.org Git - ipset/commitdiff
Help prints list type revision and terse description
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Sat, 8 Sep 2012 20:55:04 +0000 (22:55 +0200)
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Mon, 10 Sep 2012 19:24:54 +0000 (21:24 +0200)
In order to catch kernel/userspace revision mismatch, better print
all available data.

13 files changed:
include/libipset/types.h
lib/ipset_bitmap_ip.c
lib/ipset_bitmap_ipmac.c
lib/ipset_bitmap_port.c
lib/ipset_hash_ip.c
lib/ipset_hash_ipport.c
lib/ipset_hash_ipportip.c
lib/ipset_hash_ipportnet.c
lib/ipset_hash_net.c
lib/ipset_hash_netiface.c
lib/ipset_hash_netport.c
lib/ipset_list_set.c
src/ipset.c

index 1fd3f926ef21f9e3216fbea67b44991b66f2af28..333b43288b53d3f3819a411ab7604a485891e192 100644 (file)
@@ -81,6 +81,7 @@ struct ipset_type {
        uint64_t full[IPSET_CADT_MAX];          /* full args flags */
        const char *usage;                      /* terse usage */
        void (*usagefn)(void);                  /* additional usage */
+       const char *description;                /* short revision description */
 
        struct ipset_type *next;
        const char *alias[];                    /* name alias(es) */
index fae3d81e28568d2fa812df178e07f58487d6c457..212c93eb238f0c8a7e73bc3ec12680a764dcf1ff 100644 (file)
@@ -94,6 +94,7 @@ static struct ipset_type ipset_bitmap_ip0 = {
        },
 
        .usage = bitmap_ip_usage,
+       .description = "Initial revision",
 };
 
 void _init(void);
index 9f591cd289df736719cec2bc7a304aa98db0174a..da69ceb08c579233c6fa05bffd89b74b0611bca4 100644 (file)
@@ -97,6 +97,7 @@ static struct ipset_type ipset_bitmap_ipmac0 = {
        },
 
        .usage = bitmap_ipmac_usage,
+       .description = "Initial revision",
 };
 
 void _init(void);
index 7b1f83925c9c0bac545fd5aa42daec16f98b9280..9a37e351dc850139ef68c22936690d702ca7f4ee 100644 (file)
@@ -84,6 +84,7 @@ static struct ipset_type ipset_bitmap_port0 = {
        },
 
        .usage = bitmap_port_usage,
+       .description = "Initial revision",
 };
 
 void _init(void);
index 6a03d38bc2ddb52e9aafbbc8181a26112f9d3e99..6c2b049adfe136afc3f2131fce55ce407539cae9 100644 (file)
@@ -116,6 +116,7 @@ static struct ipset_type ipset_hash_ip0 = {
        },
 
        .usage = hash_ip_usage,
+       .description = "Initial revision",
 };
 
 void _init(void);
index 5e80084d3c7433e7ce09a7eb4f6c86ab227aa31e..65197d9427436d59718d7c7b74655591d9a557c5 100644 (file)
@@ -141,6 +141,7 @@ static struct ipset_type ipset_hash_ipport1 = {
 
        .usage = hash_ipport1_usage,
        .usagefn = ipset_port_usage,
+       .description = "SCTP and UDPLITE support",
 };
 
 void _init(void);
index f99d85faf512e37d11dd1ce976deabc76a078a39..58be660280571cb9ca40696b6415b1e9dea09a80 100644 (file)
@@ -152,6 +152,7 @@ static struct ipset_type ipset_hash_ipportip1 = {
 
        .usage = hash_ipportip1_usage,
        .usagefn = ipset_port_usage,
+       .description = "SCTP and UDPLITE support",
 };
 
 void _init(void);
index 5a2d97c45984470a9c5ff45724392d463b2ee196..c867e90a66e1238064f2f43744f407d5b126ab1e 100644 (file)
@@ -158,6 +158,7 @@ static struct ipset_type ipset_hash_ipportnet1 = {
 
        .usage = hash_ipportnet1_usage,
        .usagefn = ipset_port_usage,
+       .description = "SCTP and UDPLITE support",
 };
 
 static const char hash_ipportnet2_usage[] =
@@ -250,6 +251,7 @@ static struct ipset_type ipset_hash_ipportnet2 = {
 
        .usage = hash_ipportnet2_usage,
        .usagefn = ipset_port_usage,
+       .description = "Add/del range support",
 };
 
 static const struct ipset_arg hash_ipportnet3_add_args[] = {
@@ -355,6 +357,7 @@ static struct ipset_type ipset_hash_ipportnet3 = {
 
        .usage = hash_ipportnet3_usage,
        .usagefn = ipset_port_usage,
+       .description = "nomatch flag support",
 };
 
 void _init(void);
index 789bcd2ab087661a72aa251d7b98ee55680443e9..4846412a9bf603a02b37a4471c5fdfa514c1ad3b 100644 (file)
@@ -106,6 +106,7 @@ static struct ipset_type ipset_hash_net0 = {
        },
 
        .usage = hash_net0_usage,
+       .description = "Initial revision",
 };
 
 static const char hash_net1_usage[] =
@@ -160,6 +161,7 @@ static struct ipset_type ipset_hash_net1 = {
        },
 
        .usage = hash_net1_usage,
+       .description = "Add/del range support",
 };
 
 static const struct ipset_arg hash_net2_add_args[] = {
@@ -227,6 +229,7 @@ static struct ipset_type ipset_hash_net2 = {
        },
 
        .usage = hash_net2_usage,
+       .description = "nomatch flag support",
 };
 
 void _init(void);
index 298ce2a30413d27dcdaa3ef3551c2cfc26a4c25a..c14d4f264e2ecd1d6cf4346ec2c3bfdf6695af77 100644 (file)
@@ -116,6 +116,7 @@ static struct ipset_type ipset_hash_netiface0 = {
        },
 
        .usage = hash_netiface_usage,
+       .description = "Initial revision",
 };
 
 static const struct ipset_arg hash_netiface1_add_args[] = {
@@ -198,6 +199,7 @@ static struct ipset_type ipset_hash_netiface1 = {
        },
 
        .usage = hash_netiface1_usage,
+       .description = "nomatch flag support",
 };
 
 static struct ipset_type ipset_hash_netiface2 = {
@@ -255,6 +257,7 @@ static struct ipset_type ipset_hash_netiface2 = {
        },
 
        .usage = hash_netiface1_usage,
+       .description = "/0 network support",
 };
 
 void _init(void);
index e638756bb4bda780d4f672022dac85b4004f5fe9..23197381e574434744573a331f29c4e41f0c827c 100644 (file)
@@ -120,6 +120,7 @@ static struct ipset_type ipset_hash_netport1 = {
 
        .usage = hash_netport1_usage,
        .usagefn = ipset_port_usage,
+       .description = "SCTP and UDPLITE support",
 };
 
 static const char hash_netport2_usage[] =
@@ -196,6 +197,7 @@ static struct ipset_type ipset_hash_netport2 = {
 
        .usage = hash_netport2_usage,
        .usagefn = ipset_port_usage,
+       .description = "Add/del range support",
 };
 
 static const struct ipset_arg hash_netport3_add_args[] = {
@@ -285,6 +287,7 @@ static struct ipset_type ipset_hash_netport3 = {
 
        .usage = hash_netport3_usage,
        .usagefn = ipset_port_usage,
+       .description = "nomatch flag support",
 };
 
 void _init(void);
index 69a1379c5d4fef85e72d56e6d81d9be6e358bc38..b54c42e39ede38b9fd07210f0aedcf56fcd41e0c 100644 (file)
@@ -88,6 +88,7 @@ static struct ipset_type ipset_list_set0 = {
        },
 
        .usage = list_set_usage,
+       .description = "Initial revision",
 };
 
 void _init(void);
index 2709d7b787f11767aacb78b30610802835cc1a00..1e69e3ee26be9535597435db9220ad6801426999 100644 (file)
@@ -624,14 +624,14 @@ parse_commandline(int argc, char *argv[])
                                               type->family == NFPROTO_IPV4
                                                ? "INET" : "INET6");
                        } else {
-                               const char *name = NULL;
-
                                printf("\nSupported set types:\n");
                                type = ipset_types();
                                while (type) {
-                                       if (!(name && STREQ(name, type->name)))
-                                               printf("    %s\n", type->name);
-                                       name = type->name;
+                                       printf("    %s\t%s%u\t%s\n",
+                                              type->name,
+                                              strlen(type->name) < 12 ? "\t" : "",
+                                              type->revision,
+                                              type->description);
                                        type = type->next;
                                }
                        }