diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-03-08 15:13:07 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-03-08 15:13:07 +0900 |
commit | 1c982d8336c9d89732e8a481a8c90b3e7e283f6f (patch) | |
tree | 60c48bd57d3fb771ddab46a9e9e2b76b7715069b /server/fsm.go | |
parent | 608d09c90e906ed43e9206e903443753f73d80b0 (diff) |
server: support multiple route familes per peer
You can configure like the following:
[Global]
As = 65032
RouterId = "192.168.255.1"
[[NeighborList]]
NeighborAddress = "10.0.255.1"
PeerAs = 65001
[NeighborList.RouteServer]
RouteServerClient = true
[[NeighborList.AfiSafiList]]
AfiSafiName = "ipv4-unicast"
[[NeighborList.AfiSafiList]]
AfiSafiName = "ipv6-unicast"
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'server/fsm.go')
-rw-r--r-- | server/fsm.go | 15 |
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) |