Skip to content

Feat/validators network dhcp misc - #551

Closed
SJrX wants to merge 7 commits into
242.xfrom
feat/validators-network-dhcp-misc
Closed

SJrX wants to merge 7 commits into
242.xfrom
feat/validators-network-dhcp-misc

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-dhcp-misc branch from a652191 to a5c060c Compare October 24, 2026 14:41
@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Unit Test Results (grammar engine false)

1 425 tests   1 425 ✅  1m 6s ⏱️
  371 suites      0 💤
  371 files        0 ❌

Results for commit 4175a8b.

♻️ 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 true)

1 425 tests   1 425 ✅  52s ⏱️
  371 suites      0 💤
  371 files        0 ❌

Results for commit 4175a8b.

♻️ This comment has been updated with latest results.

@sjrx-claude-sandbox
sjrx-claude-sandbox force-pushed the feat/validators-network-dhcp-misc branch 3 times, most recently from 8c5ff95 to 6bb8773 Compare October 24, 2026 17:11
SJrX and others added 7 commits October 24, 2026 11:24
…ings (network-dhcp-misc batch)

Adds 33 grammar validators (36 registrations) for systemd-networkd .network
settings that previously had no value validation: DHCPv4/DHCPv6/DHCP-server
raw options, DUID type and raw data, uplink/outgoing interfaces, MUD URLs,
Domains=/NTP=/DNSSECNegativeTrustAnchors=, RequiredForOnline=, and assorted
enums. Each is modelled on the C parser at systemd 0f0682b773 and documented
with man/parser/leaf/test links; shared pieces (safe_ato* numbers with
0b/0o/sign handling, case-insensitive booleans, C-escape words, DNS names,
typed DHCP option payloads) live in BatchNetworkDhcpMiscCombinators.kt.

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

- IgnoreCarrierLoss= / IPv6OnlyPreferredSec=: replace the shared TIME_VALUE
  with a structural PARSE_SEC_TIMESPAN that follows parse_time() exactly
  (1h30min, 55s500ms, .5s and 5s.5 were flagged).
- DHCP raw options: after `ipv6address` take the whole coalesced colon run,
  then an address not starting with ':' (ipv6address::2001:db8::1 was
  flagged, ipv6address:::1 was accepted).
- [DHCPv6] SendOption=/SendVendorOption= and UplinkInterface= now dispatch
  on key / section, as the C does, via KeyOrSectionDispatchingGrammarOptionValue.
- Interface indexes are range- and octal-checked like parse_ifindex.
- safe_ato numbers: allow whitespace after '/' or ':' and sign/whitespace
  after a 0b/0o prefix.
- Note in KDoc that deprecated sections are not recognised by the plugin.

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

Several batch branches declared public helpers with the same name in the
shared grammar package (SafeAtouTerminal, UINT32_LIMIT, safeAtou,
SafeAtoNumberTerminal, BOOLEAN_ANY_CASE, COALESCED_COLONS). 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 against systemd's real parsers built at 0f0682b773 (sd-check):

- [DHCPServer] IPv6OnlyPreferredSec=: flag durations below 300s
  (MIN_V6ONLY_WAIT_USEC); systemd ignores them outside its test mode.
- [Network] Domains=: flag localhost, localhost.localdomain and their
  subdomains (is_localhost), with or without the ~ prefix.
- [DHCPServer] ServerAddress=: flag 127.0.0.0/8 and 169.254.0.0/16.
- [DHCPv4]/[DHCPv6] UserClass=, VendorClass=: flag entries that unquote
  to the empty string.
- NTP=/Domains=/DNSSECNegativeTrustAnchors=: a doubled backslash must
  start a valid dns_label_unescape escape (foo\\bar, foo\\256 refused).

Adds NetworkDhcpMiscCheckedSpan (a span predicate over a structured
sub-grammar) and networkDhcpMiscParseSecUsec for these checks, and tests
with the exact values systemd accepts and rejects.

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

242.x's BOOLEAN, BOOLEAN_FALSE and BOOLEAN_TRUE now ignore case, as
parse_boolean() does, so the batch's own NETWORK_DHCP_MISC_BOOLEAN_ANY_CASE
and BOOLEAN_FALSE_ANY_CASE copies are gone.

DNSOverTLS=, LLMNR=/MulticastDNS= and EmitLLDP= (parse_boolean first, then
a case-sensitive streq lookup) now use the explicit
PreferValidAlternativeCombinator(names, BOOLEAN) form. Tests gain
mixed-case booleans and mixed-case names that must stay invalid,
checked against systemd's parsers at 0f0682b773.

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

Replace the batch's NetworkDhcpMiscSafeAtoNumberTerminal with the shared
SafeAtoTerminal, written out at every call site with inclusive bounds:
PVID=, [Link] Group=, SubnetId= (base 16), DUIDType=, ServerAddress=
prefix, the SendOption= codes and enterprise id, and the uint8/16/32
option payloads. Drop the optional WhitespaceTerminal in front of those
numbers; the terminal models C's whitespace exactly. RequestOptions=
uses acceptsWhitespace = false, since each code is a whitespace-split
word. IFNAME_OR_IFINDEX now asks SafeAtoTerminal.valueOf() for
parse_ifindex() and spans the whole value.

Verdict changes, all confirmed with systemd's parsers at 0f0682b773:
- flagged: RequestOptions= 0b 1, 0o 7, 0b +1, 0b -0; a no-break space
  before a number after ':' or '/'
- accepted: a leading \v (whole values and after ':' or '/'), 0b\v1,
  the strtoul wrap-around in DUIDType=, and UplinkInterface= /
  OutgoingInterface= 0b 1, 0o 7, \v5

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Ship config_parse_dhcp_or_ra_route_table for NETWORK_CONFIG_SOURCE_DHCP4,
DHCP6 and NDISC ([DHCPv4], [DHCPv6] and [IPv6AcceptRA] RouteTable=)
with the shared ROUTE_TABLE_FROM_STRING grammar. The parser adds
nothing to manager_get_route_table_from_string(): no empty special case
and no extra bound. Possible networkd.conf names stay accepted.
sd-check agrees on all three keys.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@sjrx-claude-sandbox
sjrx-claude-sandbox force-pushed the feat/validators-network-dhcp-misc branch from 6bb8773 to 4175a8b Compare October 24, 2026 18:38
@SJrX SJrX closed this Oct 24, 2026
@SJrX
SJrX deleted the feat/validators-network-dhcp-misc 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