summaryrefslogtreecommitdiff
path: root/filter/data.c
diff options
context:
space:
mode:
Diffstat (limited to 'filter/data.c')
-rw-r--r--filter/data.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/filter/data.c b/filter/data.c
index 56c1fb17..276738a9 100644
--- a/filter/data.c
+++ b/filter/data.c
@@ -79,6 +79,8 @@ f_type_element_type(enum f_type t)
};
}
+const struct f_trie f_const_empty_trie = { .ipv4 = -1, };
+
const struct f_val f_const_empty_path = {
.type = T_PATH,
.val.ad = &null_adata,
@@ -91,6 +93,9 @@ const struct f_val f_const_empty_path = {
}, f_const_empty_lclist = {
.type = T_LCLIST,
.val.ad = &null_adata,
+}, f_const_empty_prefix_set = {
+ .type = T_PREFIX_SET,
+ .val.ti = &f_const_empty_trie,
};
static struct adata *
@@ -301,6 +306,12 @@ val_same(const struct f_val *v1, const struct f_val *v2)
int
clist_set_type(const struct f_tree *set, struct f_val *v)
{
+ if (!set)
+ {
+ v->type = T_VOID;
+ return 1;
+ }
+
switch (set->from.type)
{
case T_PAIR:
@@ -537,6 +548,9 @@ val_in_range(const struct f_val *v1, const struct f_val *v2)
if (v2->type != T_SET)
return F_CMP_ERROR;
+ if (!v2->val.t)
+ return 0;
+
/* With integrated Quad<->IP implicit conversion */
if ((v1->type == v2->val.t->from.type) ||
((v1->type == T_QUAD) && val_is_ip4(&(v2->val.t->from)) && val_is_ip4(&(v2->val.t->to))))