mirror of
https://github.com/osrg/gobgp.git
synced 2024-05-11 05:55:10 +00:00
peer: Set NeighborAddress before initializing dynamic peers
If State.NeighborAddress is not set, setting default configs for the dynamic peers will fail. This patch set State.NeighborAddress before setting default configs. And this patch avoids overwriting State.NeighborAddress if it is set. Signed-off-by: Satoshi Fujimoto <[email protected]>
This commit is contained in:
+4
-1
@@ -130,8 +130,11 @@ func setDefaultNeighborConfigValuesWithViper(v *viper.Viper, n *Neighbor, asn ui
|
||||
}
|
||||
}
|
||||
|
||||
if n.State.NeighborAddress == "" {
|
||||
n.State.NeighborAddress = n.Config.NeighborAddress
|
||||
}
|
||||
|
||||
n.State.PeerAs = n.Config.PeerAs
|
||||
n.State.NeighborAddress = n.Config.NeighborAddress
|
||||
n.AsPathOptions.State.AllowOwnAs = n.AsPathOptions.Config.AllowOwnAs
|
||||
|
||||
if !v.IsSet("neighbor.timers.config.connect-retry") && n.Timers.Config.ConnectRetry == 0 {
|
||||
|
||||
+3
-1
@@ -62,6 +62,9 @@ func newDynamicPeer(g *config.Global, neighborAddress string, pg *config.PeerGro
|
||||
Config: config.NeighborConfig{
|
||||
PeerGroup: pg.Config.PeerGroupName,
|
||||
},
|
||||
State: config.NeighborState{
|
||||
NeighborAddress: neighborAddress,
|
||||
},
|
||||
Transport: config.Transport{
|
||||
Config: config.TransportConfig{
|
||||
PassiveMode: true,
|
||||
@@ -82,7 +85,6 @@ func newDynamicPeer(g *config.Global, neighborAddress string, pg *config.PeerGro
|
||||
}).Debugf("Can't set default config: %s", err)
|
||||
return nil
|
||||
}
|
||||
conf.State.NeighborAddress = neighborAddress
|
||||
peer := NewPeer(g, &conf, loc, policy)
|
||||
peer.fsm.state = bgp.BGP_FSM_ACTIVE
|
||||
return peer
|
||||
|
||||
Reference in New Issue
Block a user