diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2016-01-23 20:54:23 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-02-10 23:35:41 -0800 |
commit | b19bbd415e8d33f01bcd407baece94ea1b81c957 (patch) | |
tree | e2a2ebec25d13924dfc7411ad25759c951dd70f8 /server/peer.go | |
parent | a207c90fe4544caa95d30ffaec5defee78ef6fd3 (diff) |
gobgpd: support graceful-restart restarting-speaker behavior
use `-r` option to start gobgpd in restarting-speaker mode
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'server/peer.go')
-rw-r--r-- | server/peer.go | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/server/peer.go b/server/peer.go index 5b4fd701..da76bf93 100644 --- a/server/peer.go +++ b/server/peer.go @@ -138,13 +138,14 @@ func (peer *Peer) getBestFromLocal(rfList []bgp.RouteFamily) ([]*table.Path, []* return pathList, filtered } -func (peer *Peer) handleBGPmessage(e *FsmMsg) ([]*table.Path, []*bgp.BGPMessage) { +func (peer *Peer) handleBGPmessage(e *FsmMsg) ([]*table.Path, []*bgp.BGPMessage, []bgp.RouteFamily) { m := e.MsgData.(*bgp.BGPMessage) log.WithFields(log.Fields{ "Topic": "Peer", "Key": peer.conf.Config.NeighborAddress, "data": m, }).Debug("received") + eor := []bgp.RouteFamily{} switch m.Header.Type { case bgp.BGP_MSG_ROUTE_REFRESH: @@ -167,7 +168,7 @@ func (peer *Peer) handleBGPmessage(e *FsmMsg) ([]*table.Path, []*bgp.BGPMessage) path.IsWithdraw = true accepted = append(accepted, path) } - return nil, table.CreateUpdateMsgFromPaths(accepted) + return nil, table.CreateUpdateMsgFromPaths(accepted), eor } else { log.WithFields(log.Fields{ "Topic": "Peer", @@ -181,14 +182,24 @@ func (peer *Peer) handleBGPmessage(e *FsmMsg) ([]*table.Path, []*bgp.BGPMessage) peer.adjRibIn.Update(e.PathList) paths := make([]*table.Path, 0, len(e.PathList)) for _, path := range e.PathList { + if path.IsEOR() { + family := path.GetRouteFamily() + log.WithFields(log.Fields{ + "Topic": "Peer", + "Key": peer.conf.Config.NeighborAddress, + "AddressFamily": family, + }).Debug("EOR received") + eor = append(eor, family) + continue + } if path.Filtered(peer.ID()) != table.POLICY_DIRECTION_IN { paths = append(paths, path) } } - return paths, nil + return paths, nil, eor } } - return nil, nil + return nil, nil, eor } func (peer *Peer) startFSMHandler(incoming, stateCh chan *FsmMsg) { |