summaryrefslogtreecommitdiffstats
path: root/src/ipset_hash_ipportip.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ipset_hash_ipportip.c')
-rw-r--r--src/ipset_hash_ipportip.c66
1 files changed, 35 insertions, 31 deletions
diff --git a/src/ipset_hash_ipportip.c b/src/ipset_hash_ipportip.c
index 71ed3c5..299e362 100644
--- a/src/ipset_hash_ipportip.c
+++ b/src/ipset_hash_ipportip.c
@@ -11,48 +11,58 @@
/* Parse commandline arguments */
static const struct ipset_arg hash_ipportip_create_args[] = {
- { .name = { "range", "--range", NULL },
- .has_arg = IPSET_MANDATORY_ARG, .opt = IPSET_OPT_IP,
- .parse = ipset_parse_netrange, .print = ipset_print_ip,
+ { .name = { "family", NULL },
+ .has_arg = IPSET_MANDATORY_ARG, .opt = IPSET_OPT_FAMILY,
+ .parse = ipset_parse_family, .print = ipset_print_family,
+ },
+ /* Alias: family inet */
+ { .name = { "-4", NULL },
+ .has_arg = IPSET_NO_ARG, .opt = IPSET_OPT_FAMILY,
+ .parse = ipset_parse_family,
+ },
+ /* Alias: family inet6 */
+ { .name = { "-6", NULL },
+ .has_arg = IPSET_NO_ARG, .opt = IPSET_OPT_FAMILY,
+ .parse = ipset_parse_family,
},
- { .name = { "hashsize", "--hashsize", NULL },
+ { .name = { "hashsize", NULL },
.has_arg = IPSET_MANDATORY_ARG, .opt = IPSET_OPT_HASHSIZE,
.parse = ipset_parse_uint32, .print = ipset_print_number,
},
- { .name = { "maxelem", "--maxleme", NULL },
+ { .name = { "maxelem", NULL },
.has_arg = IPSET_MANDATORY_ARG, .opt = IPSET_OPT_MAXELEM,
.parse = ipset_parse_uint32, .print = ipset_print_number,
},
- { .name = { "probes", "--probes", NULL },
- .has_arg = IPSET_MANDATORY_ARG, .opt = IPSET_OPT_PROBES,
- .parse = ipset_parse_uint8, .print = ipset_print_number,
- },
- { .name = { "resize", "--resize", NULL },
- .has_arg = IPSET_MANDATORY_ARG, .opt = IPSET_OPT_RESIZE,
- .parse = ipset_parse_uint8, .print = ipset_print_number,
- },
- { .name = { "timeout", "--timeout", NULL },
+ { .name = { "timeout", NULL },
.has_arg = IPSET_MANDATORY_ARG, .opt = IPSET_OPT_TIMEOUT,
.parse = ipset_parse_uint32, .print = ipset_print_number,
},
/* Backward compatibility */
- { .name = { "--from", NULL },
+ { .name = { "probes", NULL },
+ .has_arg = IPSET_MANDATORY_ARG, .opt = IPSET_OPT_PROBES,
+ .parse = ipset_parse_ignored, .print = ipset_print_number,
+ },
+ { .name = { "resize", NULL },
+ .has_arg = IPSET_MANDATORY_ARG, .opt = IPSET_OPT_RESIZE,
+ .parse = ipset_parse_ignored, .print = ipset_print_number,
+ },
+ { .name = { "from", NULL },
.has_arg = IPSET_MANDATORY_ARG, .opt = IPSET_OPT_IP,
- .parse = ipset_parse_single_ip,
+ .parse = ipset_parse_ignored,
},
- { .name = { "--to", NULL },
+ { .name = { "to", NULL },
.has_arg = IPSET_MANDATORY_ARG, .opt = IPSET_OPT_IP_TO,
- .parse = ipset_parse_single_ip,
+ .parse = ipset_parse_ignored,
},
- { .name = { "--network", NULL },
+ { .name = { "network", NULL },
.has_arg = IPSET_MANDATORY_ARG, .opt = IPSET_OPT_IP,
- .parse = ipset_parse_net,
+ .parse = ipset_parse_ignored,
},
{ },
};
static const struct ipset_arg hash_ipportip_add_args[] = {
- { .name = { "timeout", "--timeout", NULL },
+ { .name = { "timeout", NULL },
.has_arg = IPSET_MANDATORY_ARG, .opt = IPSET_OPT_TIMEOUT,
.parse = ipset_parse_uint32, .print = ipset_print_number,
},
@@ -60,10 +70,9 @@ static const struct ipset_arg hash_ipportip_add_args[] = {
};
static const char hash_ipportip_usage[] =
-"create SETNAME hash:ip,port,ip range IP/CIDR|FROM-TO\n"
+"create SETNAME hash:ip,port,ip\n"
" [family inet|inet6]\n"
" [hashsize VALUE] [maxelem VALUE]\n"
-" [probes VALUE] [resize VALUE]\n"
" [timeout VALUE]\n"
"add SETNAME IP,PORT,IP [timeout VALUE]\n"
"del SETNAME IP,PORT,IP\n"
@@ -71,7 +80,7 @@ static const char hash_ipportip_usage[] =
struct ipset_type ipset_hash_ipportip0 = {
.name = "hash:ip,port,ip",
- .alias = "ipportiphash",
+ .alias = { "ipportiphash", NULL },
.revision = 0,
.family = AF_INET46,
.dimension = IPSET_DIM_THREE,
@@ -97,8 +106,7 @@ struct ipset_type ipset_hash_ipportip0 = {
[IPSET_ADD] = hash_ipportip_add_args,
},
.mandatory = {
- [IPSET_CREATE] = IPSET_FLAG(IPSET_OPT_IP)
- | IPSET_FLAG(IPSET_OPT_IP_TO),
+ [IPSET_CREATE] = 0,
[IPSET_ADD] = IPSET_FLAG(IPSET_OPT_IP)
| IPSET_FLAG(IPSET_OPT_PORT)
| IPSET_FLAG(IPSET_OPT_IP2),
@@ -110,12 +118,8 @@ struct ipset_type ipset_hash_ipportip0 = {
| IPSET_FLAG(IPSET_OPT_IP2),
},
.full = {
- [IPSET_CREATE] = IPSET_FLAG(IPSET_OPT_IP)
- | IPSET_FLAG(IPSET_OPT_IP_TO)
- | IPSET_FLAG(IPSET_OPT_HASHSIZE)
+ [IPSET_CREATE] = IPSET_FLAG(IPSET_OPT_HASHSIZE)
| IPSET_FLAG(IPSET_OPT_MAXELEM)
- | IPSET_FLAG(IPSET_OPT_PROBES)
- | IPSET_FLAG(IPSET_OPT_RESIZE)
| IPSET_FLAG(IPSET_OPT_TIMEOUT),
[IPSET_ADD] = IPSET_FLAG(IPSET_OPT_IP)
| IPSET_FLAG(IPSET_OPT_PORT)