A path with AS 0 before its end is stored as a normal route, where RFC 7607 treats it as a withdrawal #141

Closed
opened 2026-10-20 03:26:02 +02:00 by clawbot · 1 comment
Collaborator

An AS path that carries AS 0 anywhere but at its end is handled as a normal path. RFC 7607 says a BGP speaker must treat an UPDATE whose AS path contains AS 0 as malformed and its announcements as withdrawn.

Where: PrefixHandler.HandleMessage and flushBatch in internal/routewatch/prefixhandler.go (since #113, only a path that is empty or ends in AS 0 deletes the peer's route); ASHandler and PeeringHandler in internal/routewatch/ read the same path.

Failure scenario: a peer announces 192.0.2.0/24 with the path [64496, 0, 64497]. routewatch stores the route with origin AS64497, and the peering handler records the peerings AS64496 with AS0 and AS0 with AS64497. A BGP speaker following RFC 7607 would have withdrawn the peer's route instead.

Found while fixing #113.

Severity: low

Definition of done

  • An announcement whose path contains AS 0 anywhere deletes the peer's route for the prefix, as a withdrawal does; the AS and peering handlers record nothing from such a path.
  • Tests, failing before the fix: [64496, 0, 64497] leaves no route for the peer and no peering involving AS 0.
  • make check passes.

Model: opus-5-5

An AS path that carries AS 0 anywhere but at its end is handled as a normal path. RFC 7607 says a BGP speaker must treat an UPDATE whose AS path contains AS 0 as malformed and its announcements as withdrawn. Where: `PrefixHandler.HandleMessage` and `flushBatch` in `internal/routewatch/prefixhandler.go` (since https://git.eeqj.de/sneak/routewatch/issues/113, only a path that is empty or ends in AS 0 deletes the peer's route); `ASHandler` and `PeeringHandler` in `internal/routewatch/` read the same path. Failure scenario: a peer announces 192.0.2.0/24 with the path `[64496, 0, 64497]`. routewatch stores the route with origin AS64497, and the peering handler records the peerings AS64496 with AS0 and AS0 with AS64497. A BGP speaker following RFC 7607 would have withdrawn the peer's route instead. Found while fixing https://git.eeqj.de/sneak/routewatch/issues/113. Severity: low ## Definition of done - An announcement whose path contains AS 0 anywhere deletes the peer's route for the prefix, as a withdrawal does; the AS and peering handlers record nothing from such a path. - Tests, failing before the fix: `[64496, 0, 64497]` leaves no route for the peer and no peering involving AS 0. - `make check` passes. Model: opus-5-5
clawbot self-assigned this 2026-10-20 03:26:02 +02:00
Author
Collaborator

Built in #146: an AS path that holds AS 0 anywhere now decodes as an empty path, so the prefix handler deletes the peer's route for the prefix and the AS and peering handlers record nothing from it.

One detail of the issue does not match the code: the peering handler already skipped pairs that include AS 0. What it still recorded from such a path were the peerings between its other ASes, such as 64496 with 64497 from [64496, 64497, 0, 64498]; that stops too.

Model: opus-5-5

Built in https://git.eeqj.de/sneak/routewatch/pulls/146: an AS path that holds AS 0 anywhere now decodes as an empty path, so the prefix handler deletes the peer's route for the prefix and the AS and peering handlers record nothing from it. One detail of the issue does not match the code: the peering handler already skipped pairs that include AS 0. What it still recorded from such a path were the peerings between its other ASes, such as 64496 with 64497 from `[64496, 64497, 0, 64498]`; that stops too. Model: opus-5-5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/routewatch#141