summaryrefslogtreecommitdiffhomepage
path: root/server/server.go
diff options
context:
space:
mode:
Diffstat (limited to 'server/server.go')
-rw-r--r--server/server.go19
1 files changed, 13 insertions, 6 deletions
diff --git a/server/server.go b/server/server.go
index 081717fc..8b12b367 100644
--- a/server/server.go
+++ b/server/server.go
@@ -1865,7 +1865,7 @@ func (server *BgpServer) handleGrpcModNeighbor(grpcReq *GrpcRequest) (sMsgs []*S
log.Infof("Peer %s is added", addr)
}
SetTcpMD5SigSockopts(listener(net.ParseIP(addr)), addr, arg.Peer.Conf.AuthPassword)
- apitoConfig := func(a *api.Peer) config.Neighbor {
+ apitoConfig := func(a *api.Peer) (config.Neighbor, error) {
var pconf config.Neighbor
if a.Conf != nil {
pconf.NeighborAddress = net.ParseIP(a.Conf.NeighborAddress)
@@ -1924,9 +1924,13 @@ func (server *BgpServer) handleGrpcModNeighbor(grpcReq *GrpcRequest) (sMsgs []*S
}
}
}
- if a.Afisafis != nil {
- for _, afisafi := range a.Afisafis.Afisafi {
- cAfiSafi := config.AfiSafi{AfiSafiName: afisafi.Name}
+ if a.Families != nil {
+ for _, family := range a.Families {
+ name, ok := bgp.AddressFamilyNameMap[bgp.RouteFamily(family)]
+ if !ok {
+ return pconf, fmt.Errorf("invalid address family: %d", family)
+ }
+ cAfiSafi := config.AfiSafi{AfiSafiName: name}
pconf.AfiSafis.AfiSafiList = append(pconf.AfiSafis.AfiSafiList, cAfiSafi)
}
} else {
@@ -1942,9 +1946,12 @@ func (server *BgpServer) handleGrpcModNeighbor(grpcReq *GrpcRequest) (sMsgs []*S
pconf.Transport.TransportConfig.LocalAddress = net.ParseIP(a.Transport.LocalAddress)
pconf.Transport.TransportConfig.PassiveMode = a.Transport.PassiveMode
}
- return pconf
+ return pconf, nil
+ }
+ configneigh, err := apitoConfig(arg.Peer)
+ if err != nil {
+ return nil, err
}
- configneigh := apitoConfig(arg.Peer)
peer := NewPeer(server.bgpConfig.Global, configneigh, server.globalRib, server.policy)
server.setPolicyByConfig(peer.ID(), configneigh.ApplyPolicy)
if peer.isRouteServerClient() {