diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2014-12-23 06:41:46 -0800 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2014-12-23 06:41:46 -0800 |
commit | 7559c36687d6456a6e0c2caa0e373395913a0a81 (patch) | |
tree | 51f3b6bfa53f5fafd4ac52f595bb47bfef8773c0 /server/peer.go | |
parent | f33719f78de63f9b51d10605e99d72222410e60d (diff) |
server: support ROUTE_REFRESH
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'server/peer.go')
-rw-r--r-- | server/peer.go | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/server/peer.go b/server/peer.go index 45fc1cf5..d1ed5fe2 100644 --- a/server/peer.go +++ b/server/peer.go @@ -61,22 +61,22 @@ func NewPeer(g config.GlobalType, peer config.NeighborType, outEventCh chan *mes func (peer *Peer) handleBGPmessage(m *bgp.BGPMessage) { j, _ := json.Marshal(m) - log.Info(string(j)) + log.Debug(string(j)) // TODO: update state here - if m.Header.Type != bgp.BGP_MSG_UPDATE { - return - } - - msg := table.NewProcessMessage(m, peer.fsm.peerInfo) - pathList := msg.ToPathList() - if len(pathList) == 0 { - return + switch m.Header.Type { + case bgp.BGP_MSG_ROUTE_REFRESH: + pathList := peer.adjRib.GetOutPathList(table.RF_IPv4_UC) + peer.sendMessages(peer.path2update(pathList)) + case bgp.BGP_MSG_UPDATE: + msg := table.NewProcessMessage(m, peer.fsm.peerInfo) + pathList := msg.ToPathList() + if len(pathList) == 0 { + return + } + peer.adjRib.UpdateIn(pathList) + peer.sendToHub("", PEER_MSG_PATH, pathList) } - - peer.adjRib.UpdateIn(pathList) - - peer.sendToHub("", PEER_MSG_PATH, pathList) } func (peer *Peer) sendMessages(msgs []*bgp.BGPMessage) { |