luci-base, luci-app-firewall: enable range of MAC addresses#8017
luci-base, luci-app-firewall: enable range of MAC addresses#8017ckorber wants to merge 2 commits into
Conversation
openwrt-ai
left a comment
There was a problem hiding this comment.
Reviewed 2 new commits.
Commit checks
d7d71590bc1(luci-base: parse for mac range): message body has a typo — "range of MAC addresses int they syntax of" should read "in the syntax of" — and uses'''as a code fence (Markdown) where plain indentation is the git-log convention. Content otherwise matches the diff.4a5a74ae217(luci-app-firewall: enable to handle mac ranges): message matches the diff.
One inline question on the macrange validator (equal-endpoint handling, plus two minor cleanups). The cross-repo dependency on openwrt/firewall4#74 is already disclosed in the PR description and the "depends on PR in other repo" label, so the missing backend support for the - range syntax is expected and not flagged here.
Note: the failing "Lua Lint" check does not appear related to this PR, which touches only JavaScript files.
Generated by Claude Code
openwrt-ai
left a comment
There was a problem hiding this comment.
Follow-up to my previous review: the inline comment referenced there failed to attach, so it is added here. Also correcting that previous note — all CI checks on this head commit are passing; please disregard the "Lua Lint" remark.
Generated by Claude Code
| return this.assert(false, multicast ? _('valid multicast MAC address') : _('valid MAC address')); | ||
| } | ||
|
|
||
| return this.assert(mac1 < mac2, multicast ? _('valid multicast MAC address range') : _('valid MAC address range')); |
There was a problem hiding this comment.
The final check uses strict <, so a degenerate range with identical endpoints (e.g. 00:11:22:33:44:55-00:11:22:33:44:55) is rejected as invalid. Is that intended? nftables accepts an equal-endpoint range, and a user pasting the same MAC into both halves would get a confusing "valid MAC address range" error. If single-address ranges should be allowed, use mac1 <= mac2.
Two smaller notes on this validator:
- The regex requires both capture groups (no
?quantifier), so oncem != nullbothm[1]andm[2]are always present. Theif (m[1])/if (m[2])guards can never be false and can be dropped. tonumberparses the addresses only to compare ordering, whileapply('macaddr', ...)is what actually validates them. Consider computingmac1/mac2after bothmacaddrchecks pass, so ordering is compared on values already known to be well-formed.
Generated by Claude Code
openwrt-ai
left a comment
There was a problem hiding this comment.
Reviewed 2 re-pushed commits.
Commit checks
054d5be"luci-base: parse for mac range" — the typo from the previous version ("int they syntax of") is now fixed. The message body still wraps the example in'''(Markdown fence) rather than plain indentation as is the git-log convention; minor, content matches the diff.a38abd2"luci-app-firewall: enable to handle mac ranges" — message matches the diff.
The macrange validator logic is unchanged from the previously reviewed version, so my earlier inline note on the strict < (rejects equal-endpoint ranges), the always-true if (m[1]) / if (m[2]) guards, and the ordering of tonumber vs the macaddr checks still stands (see the existing thread on line 799) and is not repeated here.
Generated by Claude Code
This commit is a preparation to add the possibility to block or accept a range of MAC addresses in the syntax of: ''' 00:11:22:00:00:00-00:11:22:ff:ff:ff ''' The commit depends on the PR openwrt/firewall4#74 being merged first. Signed-off-by: Christian Korber <ck@dev.tdt.de>
This commit adds the feature to handle mac ranges to `luci-app-firewall` Signed-off-by: Christian Korber <ck@dev.tdt.de>
In order to handle a range of MAC addresses it seems to be useful being able to set it in luci.
Therefore these commits use the
src_macfield to specify ranges like can be seen in the pictures.Also negation can be used to exclude a certain range for being handled.
This PR depends on openwrt/firewall4#74
Signed-off-by: <my@email.address>row (viagit commit --signoff)<package name>: titlefirst line subject for packagesIf a single MAC address is specified, it is validated by






macaddrif a range is given it is validated bymacrangeinvalid MAC address
valid MAC address
invalid range
valid range
also negation is possible
upper address is lower than lower macaddr -> error