Treat a path with AS 0 anywhere as a withdrawal (closes #141)
check / check (push) Canceled after 0s
check / check (push) Canceled after 0s
An AS path that holds AS 0 anywhere, a member of an AS set included, now decodes as an empty path. RFC 7607 makes such a path malformed and its announcements withdrawals. An empty path already gets that handling: the prefix handler deletes the peer's route for the prefix, and the AS and peering handlers record nothing from it. Before, a path such as [64496, 0, 64497] stored the route with origin AS64497, recorded both ASes, and recorded the peerings between the path's other ASes. Model: opus-5-5
This commit was merged in pull request #146.
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package routewatch
|
||||
|
||||
import (
|
||||
"maps"
|
||||
"slices"
|
||||
"testing"
|
||||
|
||||
"git.eeqj.de/sneak/routewatch/internal/logger"
|
||||
@@ -42,3 +44,25 @@ func TestASHandlerStoresTheEarliestAndLatestTimesOfANewAS(t *testing.T) {
|
||||
asn.LastSeen, second.ParsedTimestamp)
|
||||
}
|
||||
}
|
||||
|
||||
// TestASHandlerRecordsNothingFromAPathWithASZero handles an update whose AS
|
||||
// path holds AS 0 between two other ASes. RFC 7607 makes such a path
|
||||
// malformed, so neither AS is recorded.
|
||||
func TestASHandlerRecordsNothingFromAPathWithASZero(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
store := newMockStore()
|
||||
|
||||
// Built without NewASHandler's flush goroutine, so the test flushes itself.
|
||||
h := &ASHandler{db: store, logger: logger.New()}
|
||||
|
||||
msg := peerAnnouncement(testPeerIP, testV4Prefix)
|
||||
msg.Path = decodePath(t, testASNA, 0, testASNB)
|
||||
h.HandleMessage(msg)
|
||||
h.flushBatch()
|
||||
|
||||
if len(store.ASNs) > 0 {
|
||||
t.Errorf("ASes recorded = %v, want none",
|
||||
slices.Sorted(maps.Keys(store.ASNs)))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user