summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikael Magnusson <mikma@users.sourceforge.net>2023-11-25 23:37:13 +0100
committerMikael Magnusson <mikma@users.sourceforge.net>2023-11-25 23:37:13 +0100
commit9cd1941dff1d54bdc8b150a60827e5f899af3607 (patch)
tree909862d6c2ee1e962e938fe1ee1db36890f437c8
parent060ef368ba32d766ab224aa751d94936c3df7264 (diff)
parent018a77fc0bc90f74e7267b40ce3bc82074ec8582 (diff)
Merge commit '018a77fc' into wireguard-next-tmp7-1
-rw-r--r--proto/aggregator/aggregator.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/proto/aggregator/aggregator.c b/proto/aggregator/aggregator.c
index 6f6d09d5..e5c2a176 100644
--- a/proto/aggregator/aggregator.c
+++ b/proto/aggregator/aggregator.c
@@ -454,13 +454,14 @@ aggregator_rt_notify(struct proto *P, struct channel *src_ch, net *net, rte *new
for (uint val_idx = 0; val_idx < p->aggr_on_count; val_idx++)
{
int type = p->aggr_on[val_idx].type;
+ struct f_val *pos = &tmp_bucket->aggr_data[val_idx];
switch (type)
{
case AGGR_ITEM_TERM: {
const struct f_line *line = p->aggr_on[val_idx].line;
struct rte *rt1 = new;
- enum filter_return fret = f_eval_rte(line, &new, rte_update_pool, 0, NULL, &tmp_bucket->aggr_data[val_idx]);
+ enum filter_return fret = f_eval_rte(line, &new, rte_update_pool, 0, NULL, pos);
if (rt1 != new)
{
@@ -469,19 +470,36 @@ aggregator_rt_notify(struct proto *P, struct channel *src_ch, net *net, rte *new
}
if (fret > F_RETURN)
- log(L_WARN "%s.%s: Wrong number of items left on stack after evaluation of aggregation list", rt1->src->proto->name, rt1->sender);
+ log(L_WARN "%s.%s: Wrong number of items left on stack after evaluation of aggregation list", rt1->src->proto->name, rt1->sender->name);
+
+ switch (pos->type) {
+ case T_VOID:
+ case T_INT:
+ case T_BOOL:
+ case T_PAIR:
+ case T_QUAD:
+ case T_ENUM:
+ case T_IP:
+ case T_EC:
+ case T_LC:
+ case T_RD:
+ /* Fits, OK */
+ break;
+
+ default:
+ log(L_WARN "%s.%s: Expression evaluated to type %s unsupported by aggregator. Store this value as a custom attribute instead", new->src->proto->name, new->sender->name, f_type_name(pos->type));
+ *pos = (struct f_val) { .type = T_INT, .val.i = 0 };
+ }
break;
}
case AGGR_ITEM_STATIC_ATTR: {
- struct f_val *pos = &tmp_bucket->aggr_data[val_idx];
eval_static_attr(new, p->aggr_on[val_idx].sa, pos);
break;
}
case AGGR_ITEM_DYNAMIC_ATTR: {
- struct f_val *pos = &tmp_bucket->aggr_data[val_idx];
eval_dynamic_attr(new, p->aggr_on[val_idx].da, pos);
break;
}