diff options
author | Jakub Chábek <jakub.chabek@cdn77.com> | 2021-09-09 18:08:07 +0200 |
---|---|---|
committer | Jakub Chábek <jakub.chabek@cdn77.com> | 2021-09-09 18:08:07 +0200 |
commit | b773e7f92464850af7f8ee505a2af3e5e4831e7a (patch) | |
tree | 134641f25c987947f3b457912d9cd03d48c54fcd | |
parent | b931ccd0566e2852a0bf1c25b77488319d1882d0 (diff) |
Pass BGPUpdate message even on error
-rw-r--r-- | pkg/packet/bmp/bmp.go | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/pkg/packet/bmp/bmp.go b/pkg/packet/bmp/bmp.go index a704b907..8f2418c1 100644 --- a/pkg/packet/bmp/bmp.go +++ b/pkg/packet/bmp/bmp.go @@ -164,12 +164,11 @@ func NewBMPRouteMonitoring(p BMPPeerHeader, update *bgp.BGPMessage) *BMPMessage } func (body *BMPRouteMonitoring) ParseBody(msg *BMPMessage, data []byte) error { - update, err := bgp.ParseBGPMessage(data) - if err != nil { - return err - } - body.BGPUpdate = update - return nil + var err error + + body.BGPUpdate, err = bgp.ParseBGPMessage(data) + + return err } func (body *BMPRouteMonitoring) Serialize() ([]byte, error) { @@ -1065,8 +1064,13 @@ func ParseBMPMessage(data []byte) (msg *BMPMessage, err error) { err = msg.Body.ParseBody(msg, data) if err != nil { + if msg.Header.Type == BMP_MSG_ROUTE_MONITORING { + return msg, err + } + return nil, err } + return msg, nil } |