summaryrefslogtreecommitdiffhomepage
path: root/server/fsm.go
diff options
context:
space:
mode:
Diffstat (limited to 'server/fsm.go')
-rw-r--r--server/fsm.go15
1 files changed, 7 insertions, 8 deletions
diff --git a/server/fsm.go b/server/fsm.go
index 94bfc85d..f519e984 100644
--- a/server/fsm.go
+++ b/server/fsm.go
@@ -288,16 +288,15 @@ func (h *FSMHandler) active() bgp.FSMState {
}
func buildopen(global *config.Global, peerConf *config.Neighbor) *bgp.BGPMessage {
- var afi int
- if peerConf.NeighborAddress.To4() != nil {
- afi = bgp.AFI_IP
- } else {
- afi = bgp.AFI_IP6
- }
p1 := bgp.NewOptionParameterCapability(
[]bgp.ParameterCapabilityInterface{bgp.NewCapRouteRefresh()})
- p2 := bgp.NewOptionParameterCapability(
- []bgp.ParameterCapabilityInterface{bgp.NewCapMultiProtocol(uint16(afi), bgp.SAFI_UNICAST)})
+ c := []bgp.ParameterCapabilityInterface{}
+ for _, rf := range peerConf.AfiSafiList {
+ k, _ := bgp.GetRouteFamily(rf.AfiSafiName)
+ afi, safi := bgp.RouteFamilyToAfiSafi(k)
+ c = append(c, bgp.NewCapMultiProtocol(afi, safi))
+ }
+ p2 := bgp.NewOptionParameterCapability(c)
p3 := bgp.NewOptionParameterCapability(
[]bgp.ParameterCapabilityInterface{bgp.NewCapFourOctetASNumber(global.As)})
holdTime := uint16(peerConf.Timers.HoldTime)