Repository navigation
fix(filters): a whole address is that address; CIDR and patterns too - #99
Merged
Merged
Conversation
The Source IP box kept every address containing what was typed, so 10.10.1.1 also showed 10.10.1.10-19 and 10.10.1.100-199 (#98). It now reads what is typed as an address: - a whole address is that address, an IPv6 one however written; - a CIDR (10.10.1.0/24) is its range; - "*" and "?" make a pattern (10.10.1.*), matched whole; - anything else is still text the address contains, while it is typed. One definition, search.Address, for the filter in the live view, the history and exports, and for the addresses of source rules and routes. The history answers a CIDR through an ss_addr SQL function, after the index has narrowed the rows to its whole octets. The window repeats it in lib/search.ts: parseIP and ipString follow Go's netip step by step, held to it by testdata/addresses.json (52 texts, 42 cases), and the filters spec gains the address cases. The case that said 10.0.0.1 finds 10.0.0.10 was the bug, and is gone. Source rules: an address entry that is none of the above (half an address, a name) is refused when saved, since it could match nothing. The editor's preview follows the addresses as they are typed, CIDR and patterns included, and right-clicking a message opens the rule that reads its device by a range too: a new rule added after it would never be reached. The Source IP box and the rule's addresses say what they take, in the 8 languages.
This was referenced Oct 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #98.
The bug
The Source IP box kept every address that contains the typed text. Typing
10.10.1.1also showed10.10.1.10to.19and10.10.1.100to.199. The same happens in the online demo with10.10.0.2, which also shows10.10.0.23.What the box takes now
10.10.1.1fe80:0::1isfe80::1.10.10.1.0/2410.10.1.*,10.10.1.?10.10.1.(not a whole address)One definition, everywhere
search.Addressdefines what an address matches. It is used by:The history answers each kind in SQL:
ss_foldfor the others, as the text boxes already do.ss_addrSQL function. Before calling it, the index narrows the rows to those starting with the network's whole octets, so10.10.1.0/24readsLIKE '10.10.1.%'first.The window repeats all of this in
lib/search.ts:parseIPandipStringfollow Go'snetipparser andnet.IP.Stringstep by step.testdata/addresses.jsonholds them to Go: 52 address texts (leading zeros,::, embedded IPv4, zones) and 42 match cases.testdata/filters.jsongains the address cases, which the history (SQL), Go andnpm testall check.10.0.0.1to find10.0.0.10. That was the bug, and the case is gone.Source rules
10.0.0(half an address),gateway(a name).Routing
Route sources go through the same matcher. A CIDR, an exact address and
*/?behave as before.[…]character classes frompath.Matchare no longer special. A/0still takes both families.Checked
go vet(Windows, Linux),staticcheck,go test -race ./...svelte-check --fail-on-warnings,npm test(5 suites, the new address one included),npm run build