diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/peer.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/server/peer.go b/server/peer.go index 28561619..ca10c1db 100644 --- a/server/peer.go +++ b/server/peer.go @@ -138,6 +138,19 @@ func (peer *Peer) handleBGPmessage(m *bgp.BGPMessage) { case bgp.BGP_MSG_UPDATE: peer.peerConfig.BgpNeighborCommonState.UpdateRecvTime = time.Now() body := m.Body.(*bgp.BGPUpdate) + _, err := bgp.ValidateUpdateMsg(body, []bgp.RouteFamily{peer.rf}) + if err != nil { + log.WithFields(log.Fields{ + "Topic": "Peer", + "Key": peer.peerConfig.NeighborAddress, + "error": err, + }).Warn("malformed BGP update message") + m := err.(*bgp.MessageError) + if m.TypeCode != 0 { + peer.outgoing <- bgp.NewBGPNotificationMessage(m.TypeCode, m.SubTypeCode, m.Data) + } + return + } table.UpdatePathAttrs4ByteAs(body) msg := table.NewProcessMessage(m, peer.peerInfo) pathList := msg.ToPathList() |