Skip to content

config_parse_route_section: most ltypes are validated against the route-Type enum grammar #476

Description

@SJrX

Problem

ConfigParseRouteSectionOptionValue implements the route Type enum grammar
(unicast, blackhole, unreachable, …), but in AiGenerated it is registered for
nine config_parse_route_section ltypes — only one of which (ROUTE_TYPE) actually
takes that enum. The rest take numbers, booleans, or different enums, so their valid
values are mis-flagged as invalid.

Discovered while adding Gateway coverage (#475); the experimental key-marker (#474) makes
these easy to spot.

Mis-registered ltypes (correctness bug)

All of these currently resolve to the route-Type word list, which is wrong:

ltype .network key(s) actually accepts example wrongly flagged
ROUTE_PRIORITY Route.Metric unsigned integer Metric=100
ROUTE_PROTOCOL Route.Protocol kernel/boot/static/dhcp or 0–255 Protocol=static
ROUTE_PREFERENCE Route.IPv6Preference low/medium/high IPv6Preference=high
ROUTE_NEXTHOP Route.NextHop nexthop id (unsigned int) NextHop=1
ROUTE_METRIC_HOPLIMIT Route.HopLimit unsigned integer HopLimit=64
ROUTE_METRIC_INITRWND Route.InitialAdvertisedReceiveWindow unsigned integer InitialAdvertisedReceiveWindow=10
ROUTE_METRIC_QUICKACK Route.QuickAck boolean QuickAck=true
ROUTE_METRIC_FASTOPEN_NO_COOKIE Route.FastOpenNoCookie boolean FastOpenNoCookie=yes

Only ROUTE_TYPE (Route.Type) is correctly served by the enum grammar.

Also: unregistered ltypes (coverage gaps — no validation today)

These config_parse_route_section ltypes appear in the networkd gperf but have no entry
in AiGenerated, so their values aren't validated at all (same situation Gateway was in
before #475):

  • ROUTE_DESTINATIONRoute.Destination, Route.Source (address/prefix)
  • ROUTE_SCOPERoute.Scope (global/site/link/host/nowhere or number)
  • ROUTE_PREFERRED_SOURCERoute.PreferredSource (address)
  • ROUTE_TABLERoute.Table (default/main/local or number)
  • ROUTE_GATEWAY_ONLINKRoute.GatewayOnLink / Route.GatewayOnlink (boolean)
  • ROUTE_MULTIPATHRoute.MultiPathRoute
  • ROUTE_METRIC_MTURoute.MTUBytes (size)
  • ROUTE_METRIC_ADVMSSRoute.TCPAdvertisedMaximumSegmentSize (size)
  • ROUTE_METRIC_INITCWNDRoute.InitialCongestionWindow (unsigned int)
  • ROUTE_METRIC_RTO_MINRoute.TCPRetransmissionTimeoutSec (time)
  • ROUTE_METRIC_CC_ALGORoute.TCPCongestionControlAlgorithm (string)

Suggested fix

Give each ltype its own correct grammar (as done for the gateway ltypes in #475) rather
than sharing the Type-enum validator. The mis-registrations are the priority (they cause
false errors on valid configs); the unregistered ltypes are latent gaps. The key-marker
behind the experimental flag is handy for verifying each one lights up once covered.

Refs #467 #475

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions