A peer has at most one route per prefix, but both live route tables were unique on prefix, origin AS and peer. A peer that changed a prefix's origin AS left its old route behind, and a withdrawal sent in the same message as announcements was given their origin AS and missed the withdrawn route. Both tables are now unique on prefix and peer. An announcement replaces the peer's row for the prefix, origin AS included; a withdrawal deletes it without looking at an origin AS. The route counts and prefix distribution kept in memory stay exact, for IPv4 and IPv6. Model: opus-5-5
This commit was merged in pull request #82.
This commit is contained in:
@@ -107,7 +107,7 @@ CREATE TABLE IF NOT EXISTS live_routes_v4 (
|
||||
as_path TEXT NOT NULL, -- JSON array
|
||||
next_hop TEXT NOT NULL,
|
||||
last_updated DATETIME NOT NULL,
|
||||
UNIQUE(prefix, origin_asn, peer_ip)
|
||||
UNIQUE(prefix, peer_ip) -- a peer has at most one route for a prefix
|
||||
);
|
||||
|
||||
-- IPv6 routing table maintained by PrefixHandler
|
||||
@@ -120,7 +120,7 @@ CREATE TABLE IF NOT EXISTS live_routes_v6 (
|
||||
as_path TEXT NOT NULL, -- JSON array
|
||||
next_hop TEXT NOT NULL,
|
||||
last_updated DATETIME NOT NULL,
|
||||
UNIQUE(prefix, origin_asn, peer_ip)
|
||||
UNIQUE(prefix, peer_ip) -- a peer has at most one route for a prefix
|
||||
);
|
||||
|
||||
-- Indexes for live_routes_v4 table
|
||||
|
||||
Reference in New Issue
Block a user