summaryrefslogtreecommitdiffhomepage
path: root/server/fsm.go
diff options
context:
space:
mode:
authorISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2016-02-19 15:40:30 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-02-29 15:59:42 -0800
commit0b78f57ccdf63591fd211ade0b571189e070f598 (patch)
tree0c92ff928bcd4aabb9735740f98da486686b051d /server/fsm.go
parent53c5bc0258cede44d3544270309b6dd2e83cf058 (diff)
config/server: support per-peer asn
you can override `global.config.as` by `neighbor.config.local-as` Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'server/fsm.go')
-rw-r--r--server/fsm.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/server/fsm.go b/server/fsm.go
index e4007764..cc4fb95f 100644
--- a/server/fsm.go
+++ b/server/fsm.go
@@ -446,7 +446,7 @@ func (h *FSMHandler) active() (bgp.FSMState, FsmStateReason) {
break
}
fsm.conn = conn
- if fsm.gConf.Config.As != fsm.pConf.Config.PeerAs {
+ if fsm.pConf.Config.PeerType == config.PEER_TYPE_EXTERNAL {
ttl := 1
if fsm.pConf.EbgpMultihop.Config.Enabled == true {
ttl = int(fsm.pConf.EbgpMultihop.Config.MultihopTtl)
@@ -488,14 +488,14 @@ func (h *FSMHandler) active() (bgp.FSMState, FsmStateReason) {
}
}
-func capabilitiesFromConfig(gConf *config.Global, pConf *config.Neighbor) []bgp.ParameterCapabilityInterface {
+func capabilitiesFromConfig(pConf *config.Neighbor) []bgp.ParameterCapabilityInterface {
caps := make([]bgp.ParameterCapabilityInterface, 0, 4)
caps = append(caps, bgp.NewCapRouteRefresh())
for _, rf := range pConf.AfiSafis {
family, _ := bgp.GetRouteFamily(string(rf.AfiSafiName))
caps = append(caps, bgp.NewCapMultiProtocol(family))
}
- caps = append(caps, bgp.NewCapFourOctetASNumber(gConf.Config.As))
+ caps = append(caps, bgp.NewCapFourOctetASNumber(pConf.Config.LocalAs))
if c := pConf.GracefulRestart.Config; c.Enabled {
tuples := []*bgp.CapGracefulRestartTuple{}
@@ -529,10 +529,10 @@ func capabilitiesFromConfig(gConf *config.Global, pConf *config.Neighbor) []bgp.
}
func buildopen(gConf *config.Global, pConf *config.Neighbor) *bgp.BGPMessage {
- caps := capabilitiesFromConfig(gConf, pConf)
+ caps := capabilitiesFromConfig(pConf)
opt := bgp.NewOptionParameterCapability(caps)
holdTime := uint16(pConf.Timers.Config.HoldTime)
- as := gConf.Config.As
+ as := pConf.Config.LocalAs
if as > (1<<16)-1 {
as = bgp.AS_TRANS
}