diff --git a/protocols/bmp/packet/decode.go b/protocols/bmp/packet/decode.go index 2e0a0682f17f352782d638a544bdbf7b9b75535f..581411d64ec782636245a159b2545babf68f720d 100644 --- a/protocols/bmp/packet/decode.go +++ b/protocols/bmp/packet/decode.go @@ -84,12 +84,17 @@ func Decode(msg []byte) (Msg, error) { case TerminationMessageType: tm, err := decodeTerminationMessage(buf, ch) if err != nil { - return nil, fmt.Errorf("Unable to decide termination message: %v", err) + return nil, fmt.Errorf("Unable to decode termination message: %v", err) } return tm, nil case RouteMirroringMessageType: + rm, err := decodeRouteMirroringMsg(buf, ch) + if err != nil { + return nil, fmt.Errorf("Unable to decode route mirroring message: %v", err) + } + return rm, nil default: return nil, fmt.Errorf("Unexpected message type: %d", ch.MsgType) diff --git a/protocols/bmp/packet/route_mirroring.go b/protocols/bmp/packet/route_mirroring.go index 007f126204efb6f746c605c917c366eb19807829..e3d013a0f1d86248996613525236b58c88ab09ca 100644 --- a/protocols/bmp/packet/route_mirroring.go +++ b/protocols/bmp/packet/route_mirroring.go @@ -12,6 +12,11 @@ type RouteMirroringMsg struct { TLVs []*InformationTLV } +// MsgType returns the type of this message +func (rm *RouteMirroringMsg) MsgType() uint8 { + return rm.CommonHeader.MsgType +} + func decodeRouteMirroringMsg(buf *bytes.Buffer, ch *CommonHeader) (*RouteMirroringMsg, error) { rm := &RouteMirroringMsg{ CommonHeader: ch,