Skip to content

feat(firewall): traffic rules editor with visual policy list - #540

Merged
gnacho merged 1 commit into
mainfrom
feat/444-traffic-rules
Oct 17, 2026
Merged

gnacho merged 1 commit into
mainfrom
feat/444-traffic-rules

Conversation

@gnacho

@gnacho gnacho commented Oct 17, 2026

Copy link
Copy Markdown
Owner

UniFi-style traffic rules editor on native fw4 UCI sections, replacing the old zone-card rule editor:

  • Rules with action (ACCEPT/DROP/REJECT), source/destination IP/CIDR, port range, protocol (tcp/udp/any) and schedule using firewall4's real start_time/stop_time/weekdays/utc_time options. No DPI/app categories (stock OpenWrt has none) and no client groups: source/destination are IPs or CIDRs.
  • The new Traffic Rules page (connection group, gateway-only) is the only writer of firewall.rule, with named netgrip_fw_N sections; the old zone-based FirewallCard (anonymous sections) is removed and the zone diagram stays as a read-only card inside the new page.
  • Lock-out guard: a deny/reject rule whose broad source covers the management network (probe reports mgmt_cidr) with unbounded destination raises a warning before saving.
  • Add/delete through the executor with snapshot, firewall reload healthcheck and rollback; delete refuses non-managed sections. The UCI read cache is invalidated after apply/rollback so the healthcheck verifies the fresh state, not the previous one (caught live: without it every add rolled back).
  • Probe reports the UCI ruleset with managed/system marking; i18n ES/EN, demo stub, 10 unit tests for the ops planner, validators and lock-out logic.

Live-verified on a lab router: an added rule lands in UCI and is rendered by fw4 into the real nft ruleset; delete cleans both; deleting a system rule is refused.

Closes #444

UniFi-style traffic rules on native fw4 UCI sections, replacing the old
zone-card rule editor (the new editor is the only writer of
firewall.rule, with named netgrip_fw_N sections instead of anonymous
ones):

- Rules scoped by action (ACCEPT/DROP/REJECT), source and destination
  IP/CIDR (or any), port range, protocol (tcp/udp/any) and schedule
  using firewall4's real start_time/stop_time/weekdays/utc_time options.
  No DPI/application categories: stock OpenWrt has none.
- Probe reports the UCI ruleset with managed/system marking and the
  management CIDR, so the UI shows what actually landed.
- Lock-out guard: a deny/reject rule whose source covers the management
  network with unbounded destination raises a warning in the editor
  before saving (computed client-side, revalidated server-side).
- Add/delete go through the executor with snapshot, firewall reload
  healthcheck and rollback; delete refuses non-managed sections.
- New Traffic Rules page (connection group, gateway-only) with the zone
  diagram kept as a read-only card; i18n ES/EN and demo updated.
@gnacho
gnacho merged commit e25fb16 into main Oct 17, 2026
2 checks passed
@gnacho
gnacho deleted the feat/444-traffic-rules branch October 17, 2026 05:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: traffic rules (visual firewall policy matrix)

1 participant