Keep a trailing AS set out of the origin and the peerings (closes #75)
check / check (push) Canceled after 0s

A path that ends in an AS set of several members, such as
[64496, 64497, [64498, 64499]], now has no origin: its route is stored
with origin 0 (none), and no member of the set is in a peering. A set of
one member counts as that AS. An announcement with an empty path is
still not stored.

ASPath keeps such a set apart from the sequence and gives the origin.
The prefix and AS handlers take the origin from it; the peering handler
uses the sequence only. The stored AS path still lists the set's members
at the end.

The prefix and prefix length pages show origin 0 as no known origin, the
IP lookup asks no WHOIS lookup for it, and the README says what it means.

Model: opus-5-5
This commit is contained in:
2026-10-19 10:35:31 +00:00
parent 3667d09800
commit ac338d8f10
14 changed files with 395 additions and 60 deletions
@@ -213,6 +213,33 @@ func TestGetIPInfoIgnoresShortRoutes(t *testing.T) {
lookup("2001:db8::1", "2001:db8::/32", 64502)
}
// TestGetIPInfoNeedsNoWHOISRefreshForOriginZero checks that the IP lookup asks
// for no WHOIS lookup when the address's route has origin 0, no known origin,
// and still asks for one when its origin AS has no WHOIS data.
func TestGetIPInfoNeedsNoWHOISRefreshForOriginZero(t *testing.T) {
t.Parallel()
db, err := New(&config.Config{StateDir: t.TempDir()}, logger.New())
if err != nil {
t.Fatalf("failed to create database: %v", err)
}
defer func() { _ = db.Close() }()
writeOriginRoutes(t, db, map[string]int{"10.0.0.0/8": 0, "11.0.0.0/8": 64500})
for ip, want := range map[string]bool{"10.0.0.1": false, "11.0.0.1": true} {
info, err := db.GetIPInfo(ip)
if err != nil {
t.Fatalf("GetIPInfo(%s): %v", ip, err)
}
if info.NeedsWHOISRefresh != want {
t.Errorf("GetIPInfo(%s) asks for a WHOIS lookup of AS%d: %t, want %t",
ip, info.ASN, info.NeedsWHOISRefresh, want)
}
}
}
// TestLiveRouteTablesHoldOneRoutePerPrefixAndPeer checks that each live route
// table refuses a second route from a peer for a prefix, even with another
// origin AS. An upsert updates the peer's route before it would insert one, so