From 020936c8c3375e1efe44a3087c891a4b2cbfe044 Mon Sep 17 00:00:00 2001 From: Jozsef Kadlecsik Date: Tue, 22 Jun 2010 10:49:41 +0200 Subject: ipset 5: last new feature added - the hash types can now store protocol together port, not only port - lots of fixes everywhere: parser, error reporting, manpage The last bits on the todo list before announcing ipset 5: - recheck all the error messages - add possibly more tests - polish manpage --- src/ipset_hash_ipportip.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'src/ipset_hash_ipportip.c') diff --git a/src/ipset_hash_ipportip.c b/src/ipset_hash_ipportip.c index 299e362..dc121e4 100644 --- a/src/ipset_hash_ipportip.c +++ b/src/ipset_hash_ipportip.c @@ -37,6 +37,10 @@ static const struct ipset_arg hash_ipportip_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, @@ -71,12 +75,12 @@ static const struct ipset_arg hash_ipportip_add_args[] = { static const char hash_ipportip_usage[] = "create SETNAME hash:ip,port,ip\n" -" [family inet|inet6]\n" +" [family inet|inet6] [proto PROTO]\n" " [hashsize VALUE] [maxelem VALUE]\n" " [timeout VALUE]\n" -"add SETNAME IP,PORT,IP [timeout VALUE]\n" -"del SETNAME IP,PORT,IP\n" -"test SETNAME IP,PORT,IP\n"; +"add SETNAME IP,[PROTO:]PORT,IP [timeout VALUE]\n" +"del SETNAME IP,[PROTO:]PORT,IP\n" +"test SETNAME IP,[PROTO:]PORT,IP\n"; struct ipset_type ipset_hash_ipportip0 = { .name = "hash:ip,port,ip", @@ -91,8 +95,8 @@ struct ipset_type ipset_hash_ipportip0 = { .opt = IPSET_OPT_IP }, [IPSET_DIM_TWO] = { - .parse = ipset_parse_single_port, - .print = ipset_print_port, + .parse = ipset_parse_proto_port, + .print = ipset_print_proto_port, .opt = IPSET_OPT_PORT }, [IPSET_DIM_THREE] = { @@ -120,16 +124,20 @@ struct ipset_type ipset_hash_ipportip0 = { .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) + | IPSET_FLAG(IPSET_OPT_PROTO) | IPSET_FLAG(IPSET_OPT_IP2) | IPSET_FLAG(IPSET_OPT_TIMEOUT), [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), }, -- cgit v1.2.3