Remove a peer's live routes when its session goes down (closes #56)
check / check (push) Canceled after 0s
check / check (push) Canceled after 0s
RIS sends no withdrawals for the routes of a peer whose BGP session goes down, so those routes stayed in the live tables for good. The streamer now hands STATE messages to the handlers that want them. When the prefix handler gets one whose state is down, it drops the peer's updates still in its batch and notes the peer; the next flush deletes all of the peer's live routes, IPv4 and IPv6, before writing the batch, so updates the peer sends after the down are kept. The new store method keeps the in-memory route counts and prefix distribution exact, and an index on peer_ip lets it find the peer's routes without reading the whole table. Model: opus-5-5
This commit is contained in:
@@ -6,6 +6,22 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// Message types and the session state the handlers act on, as the feed writes
|
||||
// them in a message's type and state fields.
|
||||
const (
|
||||
// MessageTypeUpdate is a BGP UPDATE: announcements and withdrawals.
|
||||
MessageTypeUpdate = "UPDATE"
|
||||
|
||||
// MessageTypeState is a change in the state of the BGP session between
|
||||
// the collector and the peer.
|
||||
MessageTypeState = "STATE"
|
||||
|
||||
// StateDown is the state of a STATE message whose session has ended: the
|
||||
// collector no longer has any of the peer's routes, and sends no
|
||||
// withdrawals for them.
|
||||
StateDown = "down"
|
||||
)
|
||||
|
||||
// ASPath represents a BGP AS path as a slice of AS numbers.
|
||||
// It handles JSON unmarshaling of both simple arrays and nested AS sets,
|
||||
// flattening any nested structures into a single sequence of AS numbers.
|
||||
@@ -85,6 +101,8 @@ type RISMessage struct {
|
||||
Announcements []RISAnnouncement `json:"announcements,omitempty"`
|
||||
Withdrawals []string `json:"withdrawals,omitempty"`
|
||||
Raw string `json:"-"`
|
||||
// State is set on STATE messages: the session's new state, such as StateDown.
|
||||
State string `json:"state,omitempty"`
|
||||
}
|
||||
|
||||
// RISAnnouncement represents a BGP route announcement within a RIS message.
|
||||
|
||||
Reference in New Issue
Block a user