From 634c76c2540675e185dd6d044b49d55930fe2dc7 Mon Sep 17 00:00:00 2001 From: takt Date: Tue, 6 Sep 2022 10:42:56 +0200 Subject: [PATCH] RIS: Accept post-policy messages only (#378) --- protocols/bgp/server/bmp_router.go | 4 ++++ protocols/bgp/server/bmp_server_test.go | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/protocols/bgp/server/bmp_router.go b/protocols/bgp/server/bmp_router.go index c6928b03..f73f41af 100644 --- a/protocols/bgp/server/bmp_router.go +++ b/protocols/bgp/server/bmp_router.go @@ -210,6 +210,10 @@ func (r *Router) processMsg(msg []byte) { func (r *Router) processRouteMonitoringMsg(msg *bmppkt.RouteMonitoringMsg) { atomic.AddUint64(&r.counters.routeMonitoringMessages, 1) + if !msg.PerPeerHeader.GetLFlag() { // we're only interested in post-policy routes + return + } + n := r.neighborManager.getNeighbor(msg.PerPeerHeader.PeerDistinguisher, msg.PerPeerHeader.PeerAddress) if n == nil { log.Errorf("Received route monitoring message for non-existent neighbor %d/%v on %s", msg.PerPeerHeader.PeerDistinguisher, msg.PerPeerHeader.PeerAddress, r.address.String()) diff --git a/protocols/bgp/server/bmp_server_test.go b/protocols/bgp/server/bmp_server_test.go index f26e77a5..7c6e4aaf 100644 --- a/protocols/bgp/server/bmp_server_test.go +++ b/protocols/bgp/server/bmp_server_test.go @@ -227,7 +227,7 @@ func TestBMPServer(t *testing.T) { 0, // Msg Type (route monitoring) 0, // Peer Type (global instance peer) - 0b00100000, // Peer Flags + 0b01100000, // Peer Flags 0, 0, 0, 0, 0, 0, 0, 123, // Peer Distinguisher 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 1, 1, 1, // Peer Address (10.1.1.1) 0, 0, 0, 200, // Peer AS = 200 @@ -318,7 +318,7 @@ func TestBMPServer(t *testing.T) { 0, // Msg Type (route monitoring) 0, // Peer Type (global instance peer) - 0b00100000, // Peer Flags + 0b01100000, // Peer Flags 0, 0, 0, 0, 0, 0, 0, 123, // Peer Distinguisher 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 1, 2, 1, // Peer Address (10.1.2.1) 0, 0, 0, 222, // Peer AS = 222