summaryrefslogtreecommitdiffhomepage
path: root/pkg/packet/bmp/bmp.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/packet/bmp/bmp.go')
-rw-r--r--pkg/packet/bmp/bmp.go15
1 files changed, 14 insertions, 1 deletions
diff --git a/pkg/packet/bmp/bmp.go b/pkg/packet/bmp/bmp.go
index 780d77ca..d111d251 100644
--- a/pkg/packet/bmp/bmp.go
+++ b/pkg/packet/bmp/bmp.go
@@ -344,8 +344,21 @@ func (body *BMPStatisticsReport) ParseBody(msg *BMPMessage, data []byte) error {
s = &BMPStatsTLV64{BMPStatsTLV: tl}
case BMP_STAT_TYPE_PER_AFI_SAFI_ADJ_RIB_IN, BMP_STAT_TYPE_PER_AFI_SAFI_LOC_RIB:
s = &BMPStatsTLVPerAfiSafi64{BMPStatsTLV: tl}
- default:
+ case BMP_STAT_TYPE_REJECTED, BMP_STAT_TYPE_DUPLICATE_PREFIX,
+ BMP_STAT_TYPE_DUPLICATE_WITHDRAW, BMP_STAT_TYPE_INV_UPDATE_DUE_TO_CLUSTER_LIST_LOOP,
+ BMP_STAT_TYPE_INV_UPDATE_DUE_TO_AS_PATH_LOOP, BMP_STAT_TYPE_INV_UPDATE_DUE_TO_ORIGINATOR_ID,
+ BMP_STAT_TYPE_INV_UPDATE_DUE_TO_AS_CONFED_LOOP, BMP_STAT_TYPE_WITHDRAW_UPDATE,
+ BMP_STAT_TYPE_WITHDRAW_PREFIX, BMP_STAT_TYPE_DUPLICATE_UPDATE:
s = &BMPStatsTLV32{BMPStatsTLV: tl}
+ default:
+ switch tl.Length {
+ case 4:
+ s = &BMPStatsTLV32{BMPStatsTLV: tl}
+ case 8:
+ s = &BMPStatsTLV64{BMPStatsTLV: tl}
+ default:
+ return fmt.Errorf("value length %d is not known for unknown stat type %d", tl.Length, tl.Type)
+ }
}
if err := s.ParseValue(data); err != nil {
return err