diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-03-06 15:36:21 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-03-06 15:36:21 +0900 |
commit | a085ce2d338e9a79b98d0f9ea24c5b80bccdf0e1 (patch) | |
tree | 8bbb9d6b0d8866f20f411f60943344ab241ae202 /server/peer.go | |
parent | ea6446b4ef6e461837ed4f94216fe4fadf2964fa (diff) |
server: check route refresh afi and safi
If it's not valid, log a warning and ignore.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'server/peer.go')
-rw-r--r-- | server/peer.go | 10 |
1 files changed, 10 insertions, 0 deletions
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)) |