summaryrefslogtreecommitdiffstats
path: root/lib/types.c
diff options
context:
space:
mode:
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2010-12-22 10:43:05 +0100
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2010-12-22 10:43:05 +0100
commitd794a110478866311416bf73e2a5239253aead40 (patch)
tree23871d60f4fad0cfc5f531cce59e6adae9be92f2 /lib/types.c
parentcffe9a53f6bacb0c72d83efa19b1a9764d44dc72 (diff)
Restore mode did not work for IPv6 (reported by Elie Rosenblum)
The set cache stored the default family (INET) instead of the set family, therefore restore mode for IPv6 did not work. The set cache fixed and message aggregation reworked.
Diffstat (limited to 'lib/types.c')
-rw-r--r--lib/types.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/types.c b/lib/types.c
index 1bd4274..69dac6a 100644
--- a/lib/types.c
+++ b/lib/types.c
@@ -276,10 +276,9 @@ found:
}
#define set_family_and_type(data, match, family) do { \
- if (family == AF_UNSPEC && match->family != AF_UNSPEC) { \
+ if (family == AF_UNSPEC && match->family != AF_UNSPEC) \
family = match->family == AF_INET46 ? AF_INET : match->family;\
- ipset_data_set(data, IPSET_OPT_FAMILY, &family);\
- } \
+ ipset_data_set(data, IPSET_OPT_FAMILY, &family); \
ipset_data_set(data, IPSET_OPT_TYPE, match); \
} while (0)
@@ -293,7 +292,7 @@ adt_type_get(struct ipset_session *session)
const struct ipset_type *match;
const char *setname, *typename;
const uint8_t *revision;
- uint8_t family;
+ uint8_t family = AF_UNSPEC;
int ret;
data = ipset_session_data(session);
@@ -304,8 +303,9 @@ adt_type_get(struct ipset_session *session)
/* Check existing sets in cache */
for (s = setlist; s != NULL; s = s->next) {
if (STREQ(setname, s->name)) {
- match = s->type;
- goto found;
+ ipset_data_set(data, IPSET_OPT_FAMILY, &s->family);
+ ipset_data_set(data, IPSET_OPT_TYPE, s->type);
+ return s->type;
}
}
@@ -342,7 +342,6 @@ adt_type_get(struct ipset_session *session)
family == AF_INET6 ? "inet6" : "unspec",
*revision);
-found:
set_family_and_type(data, match, family);
return match;
@@ -396,7 +395,7 @@ ipset_type_check(struct ipset_session *session)
const struct ipset_type *t, *match = NULL;
struct ipset_data *data;
const char *typename;
- uint8_t family, revision;
+ uint8_t family = AF_UNSPEC, revision;
assert(session);
data = ipset_session_data(session);