summaryrefslogtreecommitdiffstats
path: root/lib/data.c
diff options
context:
space:
mode:
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2010-10-24 21:42:48 +0200
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2010-10-24 21:42:48 +0200
commit0d32c5c070f817229110f92d7b31df9a3e4eeec5 (patch)
tree5ee04a9e03de32d2029ad0d708811e382ca922d1 /lib/data.c
parent62a3d29539aa109fed1c8a20d63ef95948b13842 (diff)
Fixes, cleanups, commentsv5.0-pre8
- 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)
Diffstat (limited to 'lib/data.c')
-rw-r--r--lib/data.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/data.c b/lib/data.c
index 65ba209..2872c0d 100644
--- a/lib/data.c
+++ b/lib/data.c
@@ -31,6 +31,7 @@ struct ipset_data {
uint64_t ignored;
/* Setname */
char setname[IPSET_MAXNAMELEN];
+ /* Set type */
const struct ipset_type *type;
/* Common CADT options */
uint8_t cidr;
@@ -161,7 +162,7 @@ do { \
/**
* ipset_data_ignored - test and set ignored bits in the data blob
* @data: data blob
- * @flags: the option flags which is ignored
+ * @flags: the option flag to be ignored
*
* Returns true if the option was not already ignored.
*/
@@ -205,6 +206,7 @@ ipset_data_set(struct ipset_data *data, enum ipset_opt opt, const void *value)
break;
case IPSET_OPT_FAMILY:
data->family = *(const uint8_t *) value;
+ D("family set to %u", data->family);
break;
/* CADT options */
case IPSET_OPT_IP:
@@ -263,7 +265,8 @@ ipset_data_set(struct ipset_data *data, enum ipset_opt opt, const void *value)
break;
/* Create-specific options, type */
case IPSET_OPT_TYPENAME:
- ipset_strncpy(data->u.create.typename, value, IPSET_MAXNAMELEN);
+ ipset_strncpy(data->u.create.typename, value,
+ IPSET_MAXNAMELEN);
break;
case IPSET_OPT_REVISION:
data->u.create.revision = *(const uint8_t *) value;
@@ -332,7 +335,7 @@ ipset_data_get(const struct ipset_data *data, enum ipset_opt opt)
assert(data);
assert(opt != IPSET_OPT_NONE);
- if (opt != IPSET_OPT_TYPENAME && !ipset_data_test(data, opt))
+ if (!(opt == IPSET_OPT_TYPENAME || ipset_data_test(data, opt)))
return NULL;
switch (opt) {
@@ -418,11 +421,11 @@ ipset_data_get(const struct ipset_data *data, enum ipset_opt opt)
}
/**
- * ipset_data_sizeof - calculates the size for the type of data
+ * ipset_data_sizeof - calculates the size of the data type
* @opt: option kind of the data
* @family: INET family
*
- * Returns the size required to store the given option kind.
+ * Returns the size required to store the given data type.
*/
size_t
ipset_data_sizeof(enum ipset_opt opt, uint8_t family)
@@ -502,7 +505,7 @@ ipset_data_family(const struct ipset_data *data)
* @data: data blob
*
* Return the value of IPSET_OPT_CIDR stored in the data blob.
- * If it is not set, the the returned value corresponds to
+ * If it is not set, then the returned value corresponds to
* the default one according to the family type or zero.
*/
uint8_t