diff options
Diffstat (limited to 'src/ipset_hash_ipportnet.c')
-rw-r--r-- | src/ipset_hash_ipportnet.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/ipset_hash_ipportnet.c b/src/ipset_hash_ipportnet.c index a668c5e..3c073cd 100644 --- a/src/ipset_hash_ipportnet.c +++ b/src/ipset_hash_ipportnet.c @@ -7,6 +7,7 @@ #include <libipset/data.h> /* IPSET_OPT_* */ #include <libipset/parse.h> /* parser functions */ #include <libipset/print.h> /* printing functions */ +#include <libipset/ui.h> /* ipset_port_usage */ #include <libipset/types.h> /* prototypes */ /* Parse commandline arguments */ @@ -37,10 +38,6 @@ static const struct ipset_arg hash_ipportnet_create_args[] = { .has_arg = IPSET_MANDATORY_ARG, .opt = IPSET_OPT_TIMEOUT, .parse = ipset_parse_uint32, .print = ipset_print_number, }, - { .name = { "proto", NULL }, - .has_arg = IPSET_MANDATORY_ARG, .opt = IPSET_OPT_PROTO, - .parse = ipset_parse_proto, .print = ipset_print_proto, - }, /* Backward compatibility */ { .name = { "probes", NULL }, .has_arg = IPSET_MANDATORY_ARG, .opt = IPSET_OPT_PROBES, @@ -75,12 +72,15 @@ static const struct ipset_arg hash_ipportnet_add_args[] = { static const char hash_ipportnet_usage[] = "create SETNAME hash:ip,port,net\n" -" [family inet|inet6] [proto PROTO]\n" +" [family inet|inet6]\n" " [hashsize VALUE] [maxelem VALUE]\n" " [timeout VALUE]\n" -"add SETNAME IP,[PROTO:]PORT,IP[/CIDR] [timeout VALUE]\n" -"del SETNAME IP,[PROTO:]PORT,IP[/CIDR]\n" -"test SETNAME IP,[PROTO:]PORT,IP[/CIDR]\n"; +"add SETNAME IP,PROTO:PORT,IP[/CIDR] [timeout VALUE]\n" +"del SETNAME IP,PROTO:PORT,IP[/CIDR]\n" +"test SETNAME IP,PROTO:PORT,IP[/CIDR]\n\n" +"where depending on the INET family\n" +" IP are valid IPv4 or IPv6 addresses (or hostnames),\n" +" CIDR is a valid IPv4 or IPv6 CIDR prefix,\n"; struct ipset_type ipset_hash_ipportnet0 = { .name = "hash:ip,port,net", @@ -113,18 +113,20 @@ struct ipset_type ipset_hash_ipportnet0 = { [IPSET_CREATE] = 0, [IPSET_ADD] = IPSET_FLAG(IPSET_OPT_IP) | IPSET_FLAG(IPSET_OPT_PORT) + | IPSET_FLAG(IPSET_OPT_PROTO) | IPSET_FLAG(IPSET_OPT_IP2), [IPSET_DEL] = IPSET_FLAG(IPSET_OPT_IP) | IPSET_FLAG(IPSET_OPT_PORT) + | IPSET_FLAG(IPSET_OPT_PROTO) | IPSET_FLAG(IPSET_OPT_IP2), [IPSET_TEST] = IPSET_FLAG(IPSET_OPT_IP) | IPSET_FLAG(IPSET_OPT_PORT) + | IPSET_FLAG(IPSET_OPT_PROTO) | IPSET_FLAG(IPSET_OPT_IP2), }, .full = { [IPSET_CREATE] = IPSET_FLAG(IPSET_OPT_HASHSIZE) | IPSET_FLAG(IPSET_OPT_MAXELEM) - | IPSET_FLAG(IPSET_OPT_PROTO) | IPSET_FLAG(IPSET_OPT_TIMEOUT), [IPSET_ADD] = IPSET_FLAG(IPSET_OPT_IP) | IPSET_FLAG(IPSET_OPT_PORT) @@ -145,4 +147,5 @@ struct ipset_type ipset_hash_ipportnet0 = { }, .usage = hash_ipportnet_usage, + .usagefn = ipset_port_usage, }; |