From 19a0bae7b21f9a0eb9106cd964ad1316d036f8a7 Mon Sep 17 00:00:00 2001 From: Maximilian Wilhelm Date: Wed, 21 Sep 2022 15:47:19 +0200 Subject: [PATCH] Make sure LTime is set even if the BMP station didn't set it Signed-off-by: Maximilian Wilhelm --- protocols/bgp/server/bmp_router.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/protocols/bgp/server/bmp_router.go b/protocols/bgp/server/bmp_router.go index 37f31154..0af53ab8 100644 --- a/protocols/bgp/server/bmp_router.go +++ b/protocols/bgp/server/bmp_router.go @@ -248,7 +248,13 @@ func (r *Router) processRouteMonitoringMsg(msg *bmppkt.RouteMonitoringMsg) { opt := s.fsm.decodeOptions() opt.Use32BitASN = !msg.PerPeerHeader.GetAFlag() - s.msgReceived(msg.BGPUpdate, opt, msg.PerPeerHeader.GetLFlag(), msg.PerPeerHeader.Timestamp) + // Make sure timestamp is set even if the router didn't set it + ts := msg.PerPeerHeader.Timestamp + if ts == 0 { + ts = uint32(time.Now().Unix()) + } + + s.msgReceived(msg.BGPUpdate, opt, msg.PerPeerHeader.GetLFlag(), ts) } func (r *Router) processInitiationMsg(msg *bmppkt.InitiationMessage) {