Filter runtime errors and intentional rejects currently share filtered counters and trace text. Keep errors as a subset of filtered updates for compatibility, but count them separately and identify them in route traces and protocol statistics. The dedicated counters remain useful when the underlying error log is rate-limited. This avoids classifying filter failures as invalid protocol updates or adding another log source. --- nest/proto.c | 4 ++++ nest/protocol.h | 2 ++ nest/rt-table.c | 21 ++++++++++++++------- proto/pipe/pipe.c | 4 ++++ 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/nest/proto.c b/nest/proto.c index 341fe9bc..b4a068e0 100644 --- a/nest/proto.c +++ b/nest/proto.c @@ -2999,6 +2999,10 @@ channel_show_stats(struct channel *c) cli_msg(-1006, " Export withdraws: %10u --- --- %10u --- --- %10u", SRE(withdraws_received), SCE(withdraws_ignored), SCE(withdraws_accepted)); + if (SCI(updates_filter_errors) || SCE(updates_filter_errors)) + cli_msg(-1006, " Filter runtime errors: %u import, %u export", + SCI(updates_filter_errors), SCE(updates_filter_errors)); + #undef SRI #undef SRE #undef SCI diff --git a/nest/protocol.h b/nest/protocol.h index 0d5b14fb..32d73bdd 100644 --- a/nest/protocol.h +++ b/nest/protocol.h @@ -649,6 +649,7 @@ struct channel { u32 updates_received; /* Number of route updates received */ u32 updates_invalid; /* Number of route updates rejected as invalid */ u32 updates_filtered; /* Number of route updates rejected by filters */ + u32 updates_filter_errors; /* Filter runtime errors (subset of filtered) */ u32 updates_limited_rx; /* Number of route updates exceeding the rx_limit */ u32 updates_limited_in; /* Number of route updates exceeding the in_limit */ u32 withdraws_received; /* Number of route withdraws received */ @@ -660,6 +661,7 @@ struct channel { u32 updates_ignored; /* Number of route updates ignored (squashed) by channel */ u32 updates_rejected; /* Number of route updates rejected by protocol */ u32 updates_filtered; /* Number of route updates rejected by filters */ + u32 updates_filter_errors; /* Filter runtime errors (subset of filtered) */ u32 updates_accepted; /* Number of route updates accepted and exported */ u32 updates_limited; /* Number of route updates exceeding the out_limit */ u32 withdraws_ignored; /* Number of route withdraws ignored (squashed) by channel */ diff --git a/nest/rt-table.c b/nest/rt-table.c index dee61676..d6cedc09 100644 --- a/nest/rt-table.c +++ b/nest/rt-table.c @@ -1300,16 +1300,19 @@ export_filter(struct channel *c, rte *rt, int silent) } /* Evaluate actual filters */ - v = filter && ((filter == FILTER_REJECT) || - (f_run(filter, rt, - (silent ? FF_SILENT : 0)) > F_ACCEPT)); - if (v) + v = filter ? ((filter == FILTER_REJECT) ? F_REJECT : + f_run(filter, rt, (silent ? FF_SILENT : 0))) : F_ACCEPT; + if (v > F_ACCEPT) { if (silent) return false; stats->updates_filtered++; - channel_rte_trace_out(D_FILTERS, c, rt, "filtered out"); + if (v == F_ERROR) + stats->updates_filter_errors++; + + channel_rte_trace_out(D_FILTERS, c, rt, + (v == F_ERROR) ? "filter runtime error" : "filtered out"); return false; } @@ -2706,14 +2709,18 @@ rte_update(struct channel *c, const net_addr *n, rte *new, struct rte_src *src) new->net = n; new->sender = c->in_req.hook; - int fr; + int fr = F_REJECT; stats->updates_received++; if ((filter == FILTER_REJECT) || ((fr = f_run(filter, new, 0)) > F_ACCEPT)) { stats->updates_filtered++; - channel_rte_trace_in(D_FILTERS, c, new, "filtered out"); + if (fr == F_ERROR) + stats->updates_filter_errors++; + + channel_rte_trace_in(D_FILTERS, c, new, + (fr == F_ERROR) ? "filter runtime error" : "filtered out"); if (c->in_keep & RIK_REJECTED) new->flags |= REF_FILTERED; diff --git a/proto/pipe/pipe.c b/proto/pipe/pipe.c index 6cbb5799..3a008cb3 100644 --- a/proto/pipe/pipe.c +++ b/proto/pipe/pipe.c @@ -261,6 +261,10 @@ pipe_show_stats(struct pipe_proto *p) cli_msg(-1006, " Export withdraws: %10u %10u --- %10u %10u", rs1e->withdraws_received, s2i->withdraws_invalid, rs2i->withdraws_ignored, rs2i->withdraws_accepted); + + if (s2e->updates_filter_errors || s1e->updates_filter_errors) + cli_msg(-1006, " Filter runtime errors: %u import, %u export", + s2e->updates_filter_errors, s1e->updates_filter_errors); } static void -- 2.47.3