Skip to content

Feat/validators netdev link - #552

Closed
SJrX wants to merge 8 commits into
242.xfrom
feat/validators-netdev-link
Closed

SJrX wants to merge 8 commits into
242.xfrom
feat/validators-netdev-link

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-netdev-link branch from 4fc9853 to df11bf4 Compare October 24, 2026 14:40
@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Unit Test Results (grammar engine false)

1 428 tests   1 428 ✅  1m 5s ⏱️
  371 suites      0 💤
  371 files        0 ❌

Results for commit 2f351fb.

♻️ 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 428 tests   1 428 ✅  1m 4s ⏱️
  371 suites      0 💤
  371 files        0 ❌

Results for commit 2f351fb.

♻️ This comment has been updated with latest results.

@sjrx-claude-sandbox
sjrx-claude-sandbox force-pushed the feat/validators-netdev-link branch 3 times, most recently from 674e9ff to 7cbfdce Compare October 24, 2026 17:11
SJrX and others added 8 commits October 24, 2026 11:24
… batch)

Adds 34 value validators for systemd-networkd .netdev and udev .link
settings that had none (WireGuard keys/endpoints/allowed IPs/route
tables, VXLAN/GENEVE/L2TP addresses, VLAN protocol and QoS maps, MACsec
key ids and key files, CPU sets and RPS masks, ethtool advertise modes,
udev Property=, and more), plus shared helpers in
BatchNetdevLinkCombinators.kt (safe_atou numbers incl. 0b/0o/+, parse_size
SI chains, parse_nsec durations, CPU sets, key-file paths, route tables).

All grammars are derived from the C parsers at systemd 0f0682b773.

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

Adds grammar-level tests for the shared helpers (safe_atou bases, parse_size
SI chains, parse_nsec durations, CPU sets, key-file paths, WireGuard keys,
route tables) using systemd's own unit-test cases, checked against both the
classic and the list-of-successes engine. Numbers from the new terminals are
now coloured as literals, and AllowedIPs= reads prefix lengths the way
in_addr_parse_prefixlen does (safe_atou8, so /0x18 is legal).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
safe_atou_full only refuses a leading '-' when the parsed value is non-zero,
so '-0' and '-0x0' are legal. Negative numbers are now number-shaped and
reported as out of range instead of as unrecognised characters.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- Accept quotes/escapes anywhere in an extract_first_word word (CPU sets,
  RPS masks, VLAN QoS maps, udev Property= names) via a fallback
  ExtractedWordTerminal that unquotes/unescapes before checking.
- parse_range: refuse -0 as the lower bound; allow whitespace after the
  dash for PortRange= (safe_atou skips it).
- L2TP Local=: allow leading '@' separators.
- Key-file paths: catch /dev, /sys, /proc reached via '.' components.
- WireGuard Endpoint=: restrict \DDD escapes to 000-255.
- Fix PrivateKey= test fixture link; document empty-value handling.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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 .netdev/.link parsers built at 0f0682b773.

- BatmanAdvanced GatewayBandwidth*=: flag totals of 429496729600000 or
  more (12P, "3E 2P", 20E); systemd warns and stores a truncated uint32.
- VXLAN Group=/Local=/Remote=: apply the key-specific rules (local
  address type names only for Local=, Group= must be multicast, Local=
  and Remote= must not be) by picking a per-key grammar.
- GENEVE Remote=: refuse multicast addresses.
- Add NetdevLinkCheckedSpan, netdevLinkIsMulticast and
  netdevLinkParseSizeSi for checks on a parsed value.
- Tests: oracle-verified values for the above and for the questions in
  the batch notes (MACsec KeyId=0, QoS maps, Endpoint=:51820, route
  table names, PortRange=+0b1-2).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The branch had no private case-insensitive boolean copies or names-or-boolean
terminals to restructure; its only boolean use (BOOLEAN_FALSE in the WireGuard
RouteTable= validators) now inherits case-insensitivity from 242.x. Lock that in
with mixed-case false values, and add mixed-case names that systemd's
case-sensitive streq/string-table lookups reject (verified with sd-check at
0f0682b773) for IRQAffinityNUMA=, L2TP Local=, ReceivePacketSteeringCPUMask=
and VXLAN Local=.

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

Replace the branch's own safe_atou copy (NetdevLinkSafeAtouTerminal,
netdevLinkSafeAtou, UINT16_LIMIT, NETDEV_LINK_UINT32_LIMIT) and the
parseRange/parseRangeAccepts/extractedRangeWord/optionallyQuoted helpers
with SafeAtoTerminal written out at each call site, and switch [VRF]
Table=, [WireGuard] RouteTable= and [WireGuardPeer] RouteTable= to the
shared ROUTE_TABLE_FROM_STRING (deleting the local ROUTE_TABLE).

The WireGuard endpoint port now models parse_ip_port's
SAFE_ATO_REFUSE_LEADING_WHITESPACE. Words from whitespace-split lists
(IRQAffinity=, *QOSMaps=, AllowedIPs=) use acceptsWhitespace = false.

Verdict changes, all checked with sd-check at 0f0682b773:
- now accepted: `0b+1`, `0b 1`, `0o 7`, `0b -0` and `0b-0` in the
  whole-value numbers (DefaultPVID=, PartitionKey=, IPv6FlowLabel=,
  IRQAffinityNUMA=, PortRange= bounds, Endpoint= port); `0b+1` and
  `0-0b-0` inside IRQAffinity=/QOSMaps= words; `/0b+1000` in AllowedIPs=;
  route-table values containing whitespace (possible networkd.conf
  names) and `0b 1`.
- still flagged: `Endpoint=1.2.3.4: 80`, `IRQAffinity=0b 1`,
  `AllowedIPs=10.0.0.0/0b 1`.

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