From 67947eeda62ff961208b19f29c652399dd93ea97 Mon Sep 17 00:00:00 2001 From: Eiichiro Watanabe Date: Sun, 30 Dec 2018 08:49:05 +0900 Subject: Fix incorrect values in BMP Statistics Report(type 7 and 8) --- pkg/server/bmp.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'pkg/server') diff --git a/pkg/server/bmp.go b/pkg/server/bmp.go index 67ed3a91..063574c0 100644 --- a/pkg/server/bmp.go +++ b/pkg/server/bmp.go @@ -298,14 +298,17 @@ func bmpPeerRoute(t uint8, policy bool, pd uint64, fourBytesAs bool, peeri *tabl func bmpPeerStats(peerType uint8, peerDist uint64, timestamp int64, peer *api.Peer) *bmp.BMPMessage { var peerFlags uint8 = 0 ph := bmp.NewBMPPeerHeader(peerType, peerFlags, peerDist, peer.State.NeighborAddress, peer.State.PeerAs, peer.State.RouterId, float64(timestamp)) + received := uint64(0) accepted := uint64(0) for _, a := range peer.AfiSafis { + received += a.State.Received accepted += a.State.Accepted } return bmp.NewBMPStatisticsReport( *ph, []bmp.BMPStatsTLVInterface{ - bmp.NewBMPStatsTLV64(bmp.BMP_STAT_TYPE_ADJ_RIB_IN, accepted), + bmp.NewBMPStatsTLV64(bmp.BMP_STAT_TYPE_ADJ_RIB_IN, received), + bmp.NewBMPStatsTLV64(bmp.BMP_STAT_TYPE_LOC_RIB, accepted), bmp.NewBMPStatsTLV32(bmp.BMP_STAT_TYPE_WITHDRAW_UPDATE, uint32(peer.State.Messages.Received.WithdrawUpdate)), bmp.NewBMPStatsTLV32(bmp.BMP_STAT_TYPE_WITHDRAW_PREFIX, uint32(peer.State.Messages.Received.WithdrawPrefix)), }, -- cgit v1.2.3