An announcement whose path gives no origin leaves the peer's old route live and cancels a withdrawal in the same batch #113

Closed
opened 2026-10-19 22:35:21 +02:00 by clawbot · 1 comment
Collaborator

Where: PrefixHandler.flushBatch in internal/routewatch/prefixhandler.go (the announcement branch); ASPath.Origin in internal/ristypes/ris.go.

An announcement is stored only when its origin is above 0 or its path ends in an AS set; otherwise it falls through both the upsert and the withdrawal branch and does nothing. Origin() returns 0 for a path whose last AS is 0 (such as [64496, 0]) and for an empty path. In BGP a new announcement for a prefix from the same peer replaces that peer's previous route, and RFC 7607 says a path carrying AS 0 is to be treated as a withdrawal; here it is treated as nothing.

Scenario: peer X announces P with path [64496, 64497], then with path [64496, 0]. The old route stays live with origin 64497 and its old path on the prefix and AS pages and in the IP lookup, until X next withdraws or re-announces P or goes down. Within one batch it is worse: lastUpdates keeps the peer's last update per prefix, so if X withdrew P and then sent the AS-0 announcement within the same second, the withdrawal is overwritten and never applied.

#91 ruled that an empty-path announcement is not stored and left what it means for an existing route to a separate issue; this is that issue. AS 0 paths are rare misconfigurations.

Severity: low.

Definition of done

  • An announcement without a usable origin removes the peer's route for the prefix (queued as a deletion), so it neither leaves a stale route nor cancels a withdrawal in the same batch.
  • Test, failing before the fix: announce P from a peer with path [A, B], flush; announce P from the same peer with path [A, 0], flush; the peer has no live route for P (today the route with origin B remains). Same for an empty path.
  • make check passes.

Model: fable-5-1

Where: `PrefixHandler.flushBatch` in `internal/routewatch/prefixhandler.go` (the announcement branch); `ASPath.Origin` in `internal/ristypes/ris.go`. An announcement is stored only when its origin is above 0 or its path ends in an AS set; otherwise it falls through both the upsert and the withdrawal branch and does nothing. `Origin()` returns 0 for a path whose last AS is 0 (such as `[64496, 0]`) and for an empty path. In BGP a new announcement for a prefix from the same peer replaces that peer's previous route, and RFC 7607 says a path carrying AS 0 is to be treated as a withdrawal; here it is treated as nothing. Scenario: peer X announces P with path `[64496, 64497]`, then with path `[64496, 0]`. The old route stays live with origin 64497 and its old path on the prefix and AS pages and in the IP lookup, until X next withdraws or re-announces P or goes down. Within one batch it is worse: `lastUpdates` keeps the peer's last update per prefix, so if X withdrew P and then sent the AS-0 announcement within the same second, the withdrawal is overwritten and never applied. https://git.eeqj.de/sneak/routewatch/pulls/91 ruled that an empty-path announcement is not stored and left what it means for an existing route to a separate issue; this is that issue. AS 0 paths are rare misconfigurations. Severity: low. ## Definition of done - An announcement without a usable origin removes the peer's route for the prefix (queued as a deletion), so it neither leaves a stale route nor cancels a withdrawal in the same batch. - Test, failing before the fix: announce P from a peer with path `[A, B]`, flush; announce P from the same peer with path `[A, 0]`, flush; the peer has no live route for P (today the route with origin B remains). Same for an empty path. - `make check` passes. Model: fable-5-1
clawbot self-assigned this 2026-10-19 22:35:21 +02:00
Author
Collaborator

Built in #138: an announcement whose AS path is empty or ends in AS 0 now deletes the peer's route for the prefix, as a withdrawal does, so it neither leaves the old route live nor cancels a withdrawal in the same batch. A path with AS 0 before its last AS is not covered there.

Model: opus-5-5

Built in https://git.eeqj.de/sneak/routewatch/pulls/138: an announcement whose AS path is empty or ends in AS 0 now deletes the peer's route for the prefix, as a withdrawal does, so it neither leaves the old route live nor cancels a withdrawal in the same batch. A path with AS 0 before its last AS is not covered there. 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#113