From 0d32c5c070f817229110f92d7b31df9a3e4eeec5 Mon Sep 17 00:00:00 2001 From: Jozsef Kadlecsik Date: Sun, 24 Oct 2010 21:42:48 +0200 Subject: Fixes, cleanups, comments - More comments added to the code - ICMP and ICMPv6 support added to the hash:ip,port, hash:ip,port,ip and hash:ip,port,net types - hash:net and hash:ip,port,net types are reworked - hash:net,port type added - Wrong direction parameters fixed in hash:ip,port - Helps and manpage are updated - More tests added - Ugly macros are rewritten to functions in parse.c (Holger Eitzenberger) - resize related bug in hash types fixed (Holger Eitzenberger) - autoreconf patches by Jan Engelhardt applied - netlink patch minimalized: dumping can be initialized by a second parsing of the message (thanks to David and Patrick for the suggestion) - IPv4/IPv6 address attributes are introduced in order to fix the context (suggested by David) --- src/ipset_hash_ipportnet.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'src/ipset_hash_ipportnet.c') 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 /* IPSET_OPT_* */ #include /* parser functions */ #include /* printing functions */ +#include /* ipset_port_usage */ #include /* 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, }; -- cgit v1.2.3