diff options
author | Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 2010-12-13 12:31:12 +0100 |
---|---|---|
committer | Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 2010-12-13 12:31:12 +0100 |
commit | d137c0bd736985444f5ed43860d47d626250b67a (patch) | |
tree | 0fa120f3966add7ac19105fca7a16fd13a010ce3 /lib/types.c | |
parent | dcf7ea57f13f3b1e1b0d87cfa71a6a73335825c2 (diff) |
Buffered commands are just ... buffered.
Calculate the free buffer size when adding the existing attributes at the buffered
commands. If the buffer is full, cancel the unfinished nested attribute and commit
the previously buffered commands. Then restart with the current buffered command.
Thus we can get rid of the ugly maxsize parameter of the set types.
Diffstat (limited to 'lib/types.c')
-rw-r--r-- | lib/types.c | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/lib/types.c b/lib/types.c index 3d9b034..3034477 100644 --- a/lib/types.c +++ b/lib/types.c @@ -426,35 +426,6 @@ ipset_type_check(struct ipset_session *session) return match; } -static void -type_max_size(struct ipset_type *type, uint8_t family) -{ - int sizeid; - enum ipset_opt opt; - size_t max = 0; - - sizeid = family == AF_INET ? IPSET_MAXSIZE_INET : IPSET_MAXSIZE_INET6; - for (opt = IPSET_OPT_NONE + 1; opt < IPSET_OPT_MAX; opt++) { - if (!(IPSET_FLAG(opt) & IPSET_ADT_FLAGS)) - continue; - if (!(IPSET_FLAG(opt) & type->full[IPSET_ADD])) - continue; - max += MNL_ALIGN(ipset_data_sizeof(opt, family)) - + MNL_ATTR_HDRLEN; - switch (opt) { - case IPSET_OPT_IP: - case IPSET_OPT_IP_TO: - case IPSET_OPT_IP2: - /* Nested attributes */ - max += MNL_ATTR_HDRLEN; - break; - default: - break; - } - } - type->maxsize[sizeid] = max; -} - /** * ipset_type_add - add (register) a userspace set type * @type: pointer to the set type structure @@ -471,23 +442,6 @@ ipset_type_add(struct ipset_type *type) assert(type); - /* Fill out max sizes */ - switch (type->family) { - case AF_UNSPEC: - case AF_INET: - type_max_size(type, AF_INET); - break; - case AF_INET6: - type_max_size(type, AF_INET6); - break; - case AF_INET46: - type_max_size(type, AF_INET); - type_max_size(type, AF_INET6); - break; - default: - return -1; - } - /* Add to the list: higher revision numbers first */ for (t = typelist, prev = NULL; t != NULL; t = t->next) { if (STREQ(t->name, type->name)) { |