When a policy rule drops a packet, the drop reason stored with the packet is Policy blocked packet (rule <id>) (_policy_drop_reason in repeater/engine.py). The packet feed and the packet history only show the rule's id, so to find out which rule stopped a packet you have to look the id up in the policy settings by hand. The rule's name is only written to the log (PolicyEngine.evaluate puts it in reason).
Request
Include the rule's name in the drop reason, for example Policy blocked packet (rule 12: spam campaign text). The Policy blocked packet prefix stays the same, so the dashboard's policy-event count (which matches on that prefix) keeps working. Because drop_reason is already stored in the packets table, the name would then show in both the live packet feed and the packet history, so a drop can still be looked up later.
A small way to do it: add an optional rule_name to PolicyDecision, set it in PolicyEngine.evaluate next to rule_id, and use it in _policy_drop_reason when present.
Why
Operators testing anti-spam rules (for example the SpamGuard plugin, which writes descriptive rule names such as (yours) text "..." or (duplicate)) want to see at a glance which rule dropped a packet and whether it was one they added themselves. This came up from testers in the Dutch MeshCore community, who asked for the rule name in the packet feed, and for it to be kept in the packet history so it can be searched afterwards.
Thanks for openHop!
**What happens now**
When a policy rule drops a packet, the drop reason stored with the packet is `Policy blocked packet (rule <id>)` (`_policy_drop_reason` in `repeater/engine.py`). The packet feed and the packet history only show the rule's id, so to find out which rule stopped a packet you have to look the id up in the policy settings by hand. The rule's name is only written to the log (`PolicyEngine.evaluate` puts it in `reason`).
**Request**
Include the rule's name in the drop reason, for example `Policy blocked packet (rule 12: spam campaign text)`. The `Policy blocked packet` prefix stays the same, so the dashboard's policy-event count (which matches on that prefix) keeps working. Because `drop_reason` is already stored in the packets table, the name would then show in both the live packet feed and the packet history, so a drop can still be looked up later.
A small way to do it: add an optional `rule_name` to `PolicyDecision`, set it in `PolicyEngine.evaluate` next to `rule_id`, and use it in `_policy_drop_reason` when present.
**Why**
Operators testing anti-spam rules (for example the SpamGuard plugin, which writes descriptive rule names such as `(yours) text "..."` or `(duplicate)`) want to see at a glance which rule dropped a packet and whether it was one they added themselves. This came up from testers in the Dutch MeshCore community, who asked for the rule name in the packet feed, and for it to be kept in the packet history so it can be searched afterwards.
Thanks for openHop!
<!-- github-sync-id:5869847194 -->
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
What happens now
When a policy rule drops a packet, the drop reason stored with the packet is
Policy blocked packet (rule <id>)(_policy_drop_reasoninrepeater/engine.py). The packet feed and the packet history only show the rule's id, so to find out which rule stopped a packet you have to look the id up in the policy settings by hand. The rule's name is only written to the log (PolicyEngine.evaluateputs it inreason).Request
Include the rule's name in the drop reason, for example
Policy blocked packet (rule 12: spam campaign text). ThePolicy blocked packetprefix stays the same, so the dashboard's policy-event count (which matches on that prefix) keeps working. Becausedrop_reasonis already stored in the packets table, the name would then show in both the live packet feed and the packet history, so a drop can still be looked up later.A small way to do it: add an optional
rule_nametoPolicyDecision, set it inPolicyEngine.evaluatenext torule_id, and use it in_policy_drop_reasonwhen present.Why
Operators testing anti-spam rules (for example the SpamGuard plugin, which writes descriptive rule names such as
(yours) text "..."or(duplicate)) want to see at a glance which rule dropped a packet and whether it was one they added themselves. This came up from testers in the Dutch MeshCore community, who asked for the rule name in the packet feed, and for it to be kept in the packet history so it can be searched afterwards.Thanks for openHop!