_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.
## 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
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
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 was wrong
_mac_acl_changeshandled"off"and otherwise wrotemacfilter='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
macfiltereach writes are one table (_MACFILTER_BY_MODE).push_mac_aclraisesValueErrornaming the mode and the known ones before anything is sent, not even the read ofuci -q show wireless. Documented under:raises:; CHANGELOG under[Unreleased]→ Fixed.Tests
Fixtures only.
test_an_unknown_mode_raises_before_anything_is_sentfor"deny","Blacklist","disable"and"":ValueErrornaming the mode, no command sent. All four failed before (written as a deny list). pytest 349 passed, ruff, mypy,napalm-standard check/ratchetgreen.Closes #39