fix: give each route_section ltype its correct grammar (#476)#486
Open
SJrX wants to merge 1 commit into
Open
Conversation
config_parse_route_section was registered for eight ltypes all pointing at the route- Type enum grammar (unicast/blackhole/...), so valid integers/booleans/enums on those [Route] options were wrongly flagged. Re-point each to a correct grammar (verified against the systemd source): - ROUTE_PRIORITY (Metric), ROUTE_NEXTHOP (NextHop) -> uint32 - ROUTE_PROTOCOL (Protocol) -> kernel|boot|static or 0-255 - ROUTE_PREFERENCE (IPv6Preference) -> low|medium|high - ROUTE_METRIC_HOPLIMIT (HopLimit) -> 1..255 - ROUTE_METRIC_INITRWND (InitialAdvertisedReceiveWindow) -> 1..1023 (tcp window) - ROUTE_METRIC_QUICKACK, ROUTE_METRIC_FASTOPEN_NO_COOKIE -> boolean ROUTE_TYPE keeps the enum grammar. Adds six small SimpleGrammarOptionValues classes (uint32/boolean shared across their two ltypes). Works under the default engine. Test: a [Route] file of valid options now produces no warnings; bad values (non-number metric, bad preference, out-of-range protocol/hoplimit, non-boolean quickack) each flag. Still open in #476: the unregistered route_section ltypes (Scope, Table, Destination, PreferredSource, GatewayOnLink, MultiPathRoute, MTUBytes, ADVMSS, INITCWND, RTO_MIN, CC_ALGO) get no validation yet — latent gaps, not false errors. Refs #476 #467 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
What
Fixes the mis-registration in #476.
config_parse_route_sectionwas registered for eight ltypes all pointing atConfigParseRouteSectionOptionValue— the route-Type enum grammar (unicast/blackhole/…). So valid values on those[Route]options (a numericMetric=100,QuickAck=true,IPv6Preference=high, …) were wrongly flagged as invalid. Each ltype now gets its correct grammar.Grammars (verified against the systemd source, not guessed)
[Route]keyROUTE_PRIORITYMetricsafe_atou32)ROUTE_NEXTHOPNextHopROUTE_PROTOCOLProtocolkernel/boot/staticor 0–255 (route_protocol_from_string, string table + numeric fallback toUINT8_MAX)ROUTE_PREFERENCEIPv6Preferencelow/medium/high(config_parse_route_preference)ROUTE_METRIC_HOPLIMITHopLimitROUTE_METRIC_INITRWNDInitialAdvertisedReceiveWindowconfig_parse_tcp_window)ROUTE_METRIC_QUICKACKQuickAckROUTE_METRIC_FASTOPEN_NO_COOKIEFastOpenNoCookieROUTE_TYPEkeeps the enum grammar (it was the only correct one). Six smallSimpleGrammarOptionValuesclasses (uint32 and boolean each shared by their two ltypes). These work under the default engine — no flag needed.Test
A
[Route]file of valid options (Type/Metric/Protocol/IPv6Preference/NextHop/HopLimit/InitialAdvertisedReceiveWindow/QuickAck/FastOpenNoCookie) now produces no warnings; bad values (non-number metric, bad preference,Protocol=999,HopLimit=0,QuickAck=perhaps) each flag.Still open in #476
The unregistered
route_sectionltypes (Scope,Table,Destination/Source,PreferredSource,GatewayOnLink,MultiPathRoute,MTUBytes,TCPAdvertisedMaximumSegmentSize,InitialCongestionWindow,TCPRetransmissionTimeoutSec,TCPCongestionControlAlgorithm) still get no validation — latent coverage gaps, but not false errors. Can be a follow-up.Refs #476 #467
🤖 Generated with Claude Code