diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-01-16 14:24:49 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-01-16 14:24:49 +0900 |
commit | 3dc69c99b0dcbaa221ae3fd011af8bbb9f04a1d4 (patch) | |
tree | 329761ab60b545c1633d3aac58edbaef91aae8aa /packet/bgp.go | |
parent | 7d95d771ff4a4e44f005d454312c87ae4fe9d322 (diff) |
packet: handle malformed BGP Header
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'packet/bgp.go')
-rw-r--r-- | packet/bgp.go | 2 |
1 files changed, 2 insertions, 0 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 { |