summaryrefslogtreecommitdiff
path: root/nest/a-path.c
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2022-03-04 02:01:34 +0100
committerOndrej Zajicek <santiago@crfreenet.org>2022-06-27 21:13:31 +0200
commit8f3c6151b4ff11d98a20f6f9919723f0fb719161 (patch)
tree215ecd33d34beaeb685d982ac0de13181c39a3ef /nest/a-path.c
parent9b302c133f02f96edc5caa769dfd21dc9ef038b5 (diff)
Nest: Cleanups in as_path_filter()
Use struct f_val as a common argument for as_path_filter(), as suggested by Alexander Zubkov. That allows to use NULL sets as valid arguments.
Diffstat (limited to 'nest/a-path.c')
-rw-r--r--nest/a-path.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/nest/a-path.c b/nest/a-path.c
index 2e34a3d1..d5b01635 100644
--- a/nest/a-path.c
+++ b/nest/a-path.c
@@ -602,8 +602,10 @@ as_path_match_set(const struct adata *path, const struct f_tree *set)
}
const struct adata *
-as_path_filter(struct linpool *pool, const struct adata *path, const struct f_tree *set, u32 key, int pos)
+as_path_filter(struct linpool *pool, const struct adata *path, const struct f_val *set, int pos)
{
+ ASSERT((set->type == T_SET) || (set->type == T_INT));
+
if (!path)
return NULL;
@@ -629,13 +631,13 @@ as_path_filter(struct linpool *pool, const struct adata *path, const struct f_tr
u32 as = get_as(p);
int match;
- if (set)
+ if (set->type == T_SET)
{
struct f_val v = {T_INT, .val.i = as};
- match = !!find_tree(set, &v);
+ match = !!find_tree(set->val.t, &v);
}
- else
- match = (as == key);
+ else /* T_INT */
+ match = (as == set->val.i);
if (match == pos)
{