fix(wireless): refuse an unknown MAC ACL mode before sending anything #40

Merged
christianmanivong merged 1 commits from fix/mac-acl-unknown-mode into main 2026-11-12 19:06:14 +00:00
Owner

What was wrong

_mac_acl_changes handled "off" and otherwise wrote macfilter='allow' for "whitelist" and 'deny' for anything else. A mode the driver does not know (a typo, "deny", a capitalised "Blacklist", a new mode from the caller) was silently written as a deny list.

Fix

The three modes and the macfilter each writes are one table (_MACFILTER_BY_MODE). push_mac_acl raises ValueError naming the mode and the known ones before anything is sent, not even the read of uci -q show wireless. Documented under :raises:; CHANGELOG under [Unreleased] → Fixed.

Tests

Fixtures only. test_an_unknown_mode_raises_before_anything_is_sent for "deny", "Blacklist", "disable" and "": ValueError naming the mode, no command sent. All four failed before (written as a deny list). pytest 349 passed, ruff, mypy, napalm-standard check/ratchet green.

Closes #39

## What was wrong `_mac_acl_changes` handled `"off"` and otherwise wrote `macfilter='allow'` for `"whitelist"` and `'deny'` for anything else. A mode the driver does not know (a typo, `"deny"`, a capitalised `"Blacklist"`, a new mode from the caller) was silently written as a deny list. ## Fix The three modes and the `macfilter` each writes are one table (`_MACFILTER_BY_MODE`). `push_mac_acl` raises `ValueError` naming the mode and the known ones before anything is sent, not even the read of `uci -q show wireless`. Documented under `:raises:`; CHANGELOG under `[Unreleased]` → Fixed. ## Tests Fixtures only. `test_an_unknown_mode_raises_before_anything_is_sent` for `"deny"`, `"Blacklist"`, `"disable"` and `""`: `ValueError` naming the mode, no command sent. All four failed before (written as a deny list). pytest 349 passed, ruff, mypy, `napalm-standard check`/`ratchet` green. Closes #39
christianmanivong added 1 commit 2026-11-12 18:19:50 +00:00
fix(wireless): refuse an unknown MAC ACL mode before sending anything
driver / standard (pull_request) Successful in 17s
driver / lint (pull_request) Successful in 15s
driver / types (pull_request) Successful in 1m0s
driver / test (3.12) (pull_request) Successful in 1m0s
driver / test (3.13) (pull_request) Successful in 55s
driver / lowest (pull_request) Successful in 30s
driver / build (pull_request) Successful in 32s
driver / security (pull_request) Successful in 1m9s
CI / driver (pull_request) Successful in 2m41s
driver / publish (pull_request) Skipped
17d9bead50
push_mac_acl wrote macfilter='allow' for "whitelist" and 'deny' for any
other mode but "off", so a mode the driver does not know -- a typo, or a
new mode from the caller -- became a deny list. It now raises ValueError
naming the mode before the first command is sent.

Closes #39
christianmanivong merged commit 29d26e11d8 into main 2026-11-12 19:06:14 +00:00
christianmanivong deleted branch fix/mac-acl-unknown-mode 2026-11-12 19:06:14 +00:00
Sign in to join this conversation.