From a085ce2d338e9a79b98d0f9ea24c5b80bccdf0e1 Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Fri, 6 Mar 2015 15:36:21 +0900 Subject: server: check route refresh afi and safi If it's not valid, log a warning and ignore. Signed-off-by: FUJITA Tomonori --- server/peer.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'server/peer.go') diff --git a/server/peer.go b/server/peer.go index 91d7894b..8f456b83 100644 --- a/server/peer.go +++ b/server/peer.go @@ -132,6 +132,16 @@ func (peer *Peer) handleBGPmessage(m *bgp.BGPMessage) { } case bgp.BGP_MSG_ROUTE_REFRESH: + rr := m.Body.(*bgp.BGPRouteRefresh) + rf := bgp.AfiSafiToRouteFamily(rr.AFI, rr.SAFI) + if peer.rf != rf { + log.WithFields(log.Fields{ + "Topic": "Peer", + "Key": peer.peerConfig.NeighborAddress, + "Data": rf, + }).Warn("Route family isn't supported") + return + } if _, ok := peer.capMap[bgp.BGP_CAP_ROUTE_REFRESH]; ok { pathList := peer.adjRib.GetOutPathList(peer.rf) peer.sendMessages(table.CreateUpdateMsgFromPaths(pathList)) -- cgit v1.2.3