diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-10-21 09:00:06 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-10-21 09:00:06 +0900 |
commit | 6be902345412117bf098e6d115c27ec49085432c (patch) | |
tree | 8020c15efa1a85996c273848bc36bc246991021a | |
parent | cbd955e97ea823984be95d4a685d55c1dfe2b1af (diff) |
server: avoid updating peer's LocalAddress unnecessary
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | server/server.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/server/server.go b/server/server.go index fca7f54d..1cec47b8 100644 --- a/server/server.go +++ b/server/server.go @@ -726,8 +726,10 @@ func (server *BgpServer) handleFSMMessage(peer *Peer, e *fsmMsg, incoming chan * close(peer.outgoing) peer.outgoing = make(chan *bgp.BGPMessage, 128) if nextState == bgp.BGP_FSM_ESTABLISHED { + // update for export policy + laddr, lport := peer.fsm.LocalHostPort() + peer.conf.Transport.TransportConfig.LocalAddress = net.ParseIP(laddr) if ch := server.bmpClient.send(); ch != nil { - laddr, lport := peer.fsm.LocalHostPort() _, rport := peer.fsm.RemoteHostPort() m := &broadcastBMPMsg{ ch: ch, @@ -1273,8 +1275,6 @@ func (server *BgpServer) getBestFromLocal(peer *Peer) ([]*table.Path, []*table.P pathList, filtered = peer.ApplyPolicy(table.POLICY_DIRECTION_EXPORT, filterpath(peer, peer.getBests(peer.localRib))) } else { rib := server.globalRib - l, _ := peer.fsm.LocalHostPort() - peer.conf.Transport.TransportConfig.LocalAddress = net.ParseIP(l) bests := rib.ApplyPolicy(table.POLICY_DIRECTION_EXPORT, filterpath(peer, peer.getBests(rib))) pathList = make([]*table.Path, 0, len(bests)) for _, path := range bests { |