summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--packet/bgp.go2
-rw-r--r--server/fsm.go10
2 files changed, 11 insertions, 1 deletions
diff --git a/packet/bgp.go b/packet/bgp.go
index c001686f..407b4b9f 100644
--- a/packet/bgp.go
+++ b/packet/bgp.go
@@ -2625,6 +2625,8 @@ func parseBody(h *BGPHeader, data []byte) (*BGPMessage, error) {
msg.Body = &BGPKeepAlive{}
case BGP_MSG_ROUTE_REFRESH:
msg.Body = &BGPRouteRefresh{}
+ default:
+ return nil, NewMessageError(BGP_ERROR_MESSAGE_HEADER_ERROR, BGP_ERROR_SUB_BAD_MESSAGE_TYPE, nil, "unknown message type")
}
err := msg.Body.DecodeFromBytes(data)
if err != nil {
diff --git a/server/fsm.go b/server/fsm.go
index 81050b31..fcc4adfb 100644
--- a/server/fsm.go
+++ b/server/fsm.go
@@ -205,7 +205,15 @@ func (h *FSMHandler) recvMessageWithError() error {
hd := &bgp.BGPHeader{}
err = hd.DecodeFromBytes(headerBuf)
if err != nil {
- h.errorCh <- true
+ log.WithFields(log.Fields{
+ "Topic": "Peer",
+ "Key": h.fsm.peerConfig.NeighborAddress,
+ "error": err,
+ }).Warn("malformed BGP Header")
+ h.msgCh <- &fsmMsg{
+ MsgType: FSM_MSG_BGP_MESSAGE,
+ MsgData: err,
+ }
return err
}