From be2524ee3e158a0d248d730f727da80bab09aed8 Mon Sep 17 00:00:00 2001 From: Satoshi Fujimoto Date: Tue, 13 Jun 2017 14:04:50 +0900 Subject: 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 --- server/mrt.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'server/mrt.go') diff --git a/server/mrt.go b/server/mrt.go index f4a22658..e2cfa6fc 100644 --- a/server/mrt.go +++ b/server/mrt.go @@ -109,7 +109,7 @@ func (m *mrtWriter) loop() error { t := uint32(time.Now().Unix()) peers := make([]*mrt.Peer, 0, len(m.Neighbor)) for _, pconf := range m.Neighbor { - peers = append(peers, mrt.NewPeer(pconf.State.RemoteRouterId, pconf.Config.NeighborAddress, pconf.Config.PeerAs, true)) + peers = append(peers, mrt.NewPeer(pconf.State.RemoteRouterId, pconf.State.NeighborAddress, pconf.Config.PeerAs, true)) } if bm, err := mrt.NewMRTMessage(t, mrt.TABLE_DUMPv2, mrt.PEER_INDEX_TABLE, mrt.NewPeerIndexTable(m.RouterId, "", peers)); err != nil { break @@ -119,7 +119,7 @@ func (m *mrtWriter) loop() error { idx := func(p *table.Path) uint16 { for i, pconf := range m.Neighbor { - if p.GetSource().Address.String() == pconf.Config.NeighborAddress { + if p.GetSource().Address.String() == pconf.State.NeighborAddress { return uint16(i) } } -- cgit v1.2.3