diff options
author | Satoshi Fujimoto <satoshi.fujimoto7@gmail.com> | 2017-06-13 14:04:50 +0900 |
---|---|---|
committer | Satoshi Fujimoto <satoshi.fujimoto7@gmail.com> | 2017-06-16 09:09:47 +0900 |
commit | be2524ee3e158a0d248d730f727da80bab09aed8 (patch) | |
tree | e27c107dc19f448bcfdd325f88cb27d82c406da4 /server/peer.go | |
parent | 83684d5e62fb14596aabf03747a8b395543f91bb (diff) |
config: Use State to get NeighborAddress instead of Config
By introducing dynamic neighbor feature,
GoBGP can have dynamic neighbors,
and corresponding Config.NeighboAddress can be empty.
This patch sets State.NeighborAddress for all neighbors,
and gets the neighbor's address from them.
Signed-off-by: Satoshi Fujimoto <satoshi.fujimoto7@gmail.com>
Diffstat (limited to 'server/peer.go')
-rw-r--r-- | server/peer.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/server/peer.go b/server/peer.go index 8adc6a22..4e5b7435 100644 --- a/server/peer.go +++ b/server/peer.go @@ -44,11 +44,11 @@ func NewPeerGroup(c *config.PeerGroup) *PeerGroup { } func (pg *PeerGroup) AddMember(c config.Neighbor) { - pg.members[c.Config.NeighborAddress] = c + pg.members[c.State.NeighborAddress] = c } func (pg *PeerGroup) DeleteMember(c config.Neighbor) { - delete(pg.members, c.Config.NeighborAddress) + delete(pg.members, c.State.NeighborAddress) } type Peer struct { @@ -71,7 +71,7 @@ func NewPeer(g *config.Global, conf *config.Neighbor, loc *table.TableManager, p prefixLimitWarned: make(map[bgp.RouteFamily]bool), } if peer.isRouteServerClient() { - peer.tableId = conf.Config.NeighborAddress + peer.tableId = conf.State.NeighborAddress } else { peer.tableId = table.GLOBAL_RIB_NAME } @@ -81,7 +81,7 @@ func NewPeer(g *config.Global, conf *config.Neighbor, loc *table.TableManager, p } func (peer *Peer) ID() string { - return peer.fsm.pConf.Config.NeighborAddress + return peer.fsm.pConf.State.NeighborAddress } func (peer *Peer) TableID() string { @@ -360,7 +360,7 @@ func (peer *Peer) processOutgoingPaths(paths, olds []*table.Path) []*table.Path if peer.fsm.pConf.GracefulRestart.State.LocalRestarting { log.WithFields(log.Fields{ "Topic": "Peer", - "Key": peer.fsm.pConf.Config.NeighborAddress, + "Key": peer.fsm.pConf.State.NeighborAddress, }).Debug("now syncing, suppress sending updates") return nil } @@ -478,7 +478,7 @@ func (peer *Peer) handleUpdate(e *FsmMsg) ([]*table.Path, []bgp.RouteFamily, *bg update := m.Body.(*bgp.BGPUpdate) log.WithFields(log.Fields{ "Topic": "Peer", - "Key": peer.fsm.pConf.Config.NeighborAddress, + "Key": peer.fsm.pConf.State.NeighborAddress, "nlri": update.NLRI, "withdrawals": update.WithdrawnRoutes, "attributes": update.PathAttributes, |