Skip to content

Feat/validators network route addr - #556

Closed
SJrX wants to merge 6 commits into
242.xfrom
feat/validators-network-route-addr
Closed

SJrX wants to merge 6 commits into
242.xfrom
feat/validators-network-route-addr

Conversation

@SJrX

@SJrX SJrX commented Oct 24, 2026

Copy link
Copy Markdown
Owner

No description provided.

@sjrx-claude-sandbox
sjrx-claude-sandbox force-pushed the feat/validators-network-route-addr branch from 3779a2d to 060a232 Compare October 24, 2026 14:41
@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Unit Test Results (grammar engine true)

1 425 tests   1 425 ✅  1m 12s ⏱️
  370 suites      0 💤
  370 files        0 ❌

Results for commit 2f917d2.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Unit Test Results (grammar engine false)

1 425 tests   1 425 ✅  48s ⏱️
  370 suites      0 💤
  370 files        0 ❌

Results for commit 2f917d2.

♻️ This comment has been updated with latest results.

@sjrx-claude-sandbox
sjrx-claude-sandbox force-pushed the feat/validators-network-route-addr branch 3 times, most recently from 3ecd32b to 32d0455 Compare October 24, 2026 17:11
SJrX and others added 6 commits October 24, 2026 11:24
…d RA settings (network-route-addr batch)

Adds C-grounded value grammars (systemd 0f0682b773) for the [Route],
[RoutingPolicyRule], [Address], [Neighbor], [IPv6AddressLabel],
[IPv6SendRA]/[IPv6RoutePrefix]/[IPv6PREF64Prefix]/[IPv6AcceptRA] and [CAN]
settings, plus the generic match/strv/string parsers, with tests for each.

Shared helpers live in BatchNetworkRouteAddrCombinators.kt: a Checked
value-predicate wrapper, a safe_atou*-accurate number terminal, structural
parse_sec()/parse_size() grammars with exact value evaluation, and
extract_first_word() word shapes.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- RoutingPolicyRule User=: no longer crash the new engine on an over-long
  UID (toLongOrNull); Checked now only runs its predicate on spans whose
  tokens are all individually valid.
- RoutingPolicyRule IPProtocol=: accept aggfrag (the generated table comes
  from systemd's vendored uapi headers), and refuse numbers that have no
  IPPROTO_* name, as parse_ip_protocol_full(relaxed=false) does.
- NFTSet=: model extract_many_words(":") separator coalescing (leading,
  repeated and trailing colons) and quotes anywhere in a word.
- safe_atou* skip leading whitespace: accept it after ':' / '/' in
  RouteMetric=, IPv6 route/label prefixes and FirewallMark= masks; accept a
  single trailing ':' on the RouteMetric= triple.
- parse_sec: refuse '+.5'.
- IPv6SendRA=: boolean only (key-specific check); IPv6PrefixDelegation=
  keeps static/dhcpv6.
- Stacked netdevs: refuse names parse_ifindex() reads as an ifindex (0x10).
- RoutingPolicyRule Table= reports its own parser name; evidence anchors
  corrected.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… names

Several batch branches declared top-level helpers with the same name in the
shared grammar package (SafeAtouTerminal, UINT32_LIMIT, BOOLEAN_ANY_CASE,
PARSE_SEC, USEC_INFINITY). Each branch compiled alone but any two merged
together would not. Prefix them per family so the batch PRs can merge in
any order; consolidating them into Combinators.kt is left for a follow-up.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Checked every network-route-addr mismatch from the systemd oracle diff
against the real parsers at 0f0682b773. None is a plugin bug:

- IPv6SendRA=static/dhcpv6: the inspection already flags them per key;
  the diff harness only sees the shared union combinator.
- BootFilename=/NetLabel= with quotes or backslashes: systemd logs at
  warning level but drops the value (and for NetLabel= the whole
  [Address] section), so the plugin keeps flagging them.
- Route/RoutingPolicyRule Table= names, User= names and Timezone=
  existence depend on networkd.conf, NSS and tzdata at runtime, so they
  stay deliberately lenient.

Adds the oracle-verified values to the tests and refreshes a stale
comment that said the TABLE/FWMARK/IP_PROTOCOL ltypes were unvalidated.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…dr validators

Drop NETWORK_ROUTE_ADDR_BOOLEAN_ANY_CASE now that BOOLEAN matches parse_boolean()'s
STRCASE_IN_SET. IPv6SendRA=/IPv6PrefixDelegation= use the explicit
PreferValidAlternativeCombinator(names, BOOLEAN) form, with case-sensitive names as
string_table_lookup_from_string uses streq. IPProtocol= keeps ignoreCase (gperf
--ignore-case plus an ascii_strlower retry) and moves to PreferValidAlternativeCombinator
so the lenient name regex cannot shadow a number on the classic engine.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…tors (#563)

Replace the batch-local NetworkRouteAddrSafeAtouTerminal, safeAtouValue()
and NETWORK_ROUTE_ADDR_UINT32_LIMIT with SafeAtoTerminal, and switch
[Route] Table= / [RoutingPolicyRule] Table= to ROUTE_TABLE_FROM_STRING
(dropping the private ROUTE_TABLE_NAME). parse_uid in
[RoutingPolicyRule] User= and parse_ifindex in MultiPathRoute= and the
stacked-netdev names now use SafeAtoTerminal too, with safe_atoi's
signedness.

Verdict changes, each confirmed with sd-check at 0f0682b773:
- now flagged (EINVAL, glibc C23 0b parsing is off): +0b1, -0b0, +0o7
  in InitialCongestionWindow=, Label=, FirewallMark=, RouteMetric=,
  the MultiPathRoute= weight, prefix lengths, and IPProtocol=+0b110
- now accepted: 0b 1, 0b+1, 0o 7 and a leading \v wherever the whole
  value or a field after ':' or '/' reaches safe_atou*; Table=0b 1;
  Table=main table (possible networkd.conf name); VLAN=+0b1 (not an
  ifindex, so a valid name); User=\v5 and User=5-\v6

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@sjrx-claude-sandbox
sjrx-claude-sandbox force-pushed the feat/validators-network-route-addr branch from 32d0455 to 2f917d2 Compare October 24, 2026 18:37
@SJrX SJrX closed this Oct 24, 2026
@SJrX
SJrX deleted the feat/validators-network-route-addr branch October 24, 2026 20:38
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.

1 participant