]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Filter: Add missing operations for clists of ints
authorIgor Putovny <igor.putovny@nic.cz>
Wed, 22 Apr 2026 14:49:05 +0000 (16:49 +0200)
committerOndrej Zajicek <santiago@crfreenet.org>
Thu, 23 Apr 2026 14:17:58 +0000 (16:17 +0200)
Despite that clist can be used with ints as its values, some operations
(specifically matching and ones with set arguments) were not properly
implemented.

filter/data.c

index 211faeea5cd32a63fb6cf4d563ff646d4fce72c8..8547f26c24ab8773024148a0a62420fb8c6b772f 100644 (file)
@@ -327,6 +327,10 @@ clist_set_type(const struct f_tree *set, struct f_val *v)
 
   switch (set->from.type)
   {
+  case T_INT:
+    v->type = T_INT;
+    return 1;
+
   case T_PAIR:
     v->type = T_PAIR;
     return 1;
@@ -534,7 +538,7 @@ val_in_range(const struct f_val *v1, const struct f_val *v2)
   if ((v1->type == T_INT) && (v2->type == T_PATH))
     return as_path_contains(v2->val.ad, v1->val.i, 1);
 
-  if (((v1->type == T_PAIR) || (v1->type == T_QUAD)) && (v2->type == T_CLIST))
+  if (((v1->type == T_INT) || (v1->type == T_PAIR) || (v1->type == T_QUAD)) && (v2->type == T_CLIST))
     return int_set_contains(v2->val.ad, v1->val.i);
   /* IP->Quad implicit conversion */
   if (val_is_ip4(v1) && (v2->type == T_CLIST))