diff options
-rw-r--r-- | api/grpc_server.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/api/grpc_server.go b/api/grpc_server.go index 654ef78c..34139d4e 100644 --- a/api/grpc_server.go +++ b/api/grpc_server.go @@ -574,10 +574,14 @@ func (s *Server) InjectMrt(stream GobgpApi_InjectMrtServer) error { } func (s *Server) AddBmp(ctx context.Context, arg *AddBmpRequest) (*AddBmpResponse, error) { + t, ok := config.IntToBmpRouteMonitoringPolicyTypeMap[int(arg.Type)] + if !ok { + return nil, fmt.Errorf("invalid bmp route monitoring policy: %d", arg.Type) + } return &AddBmpResponse{}, s.bgpServer.AddBmp(&config.BmpServerConfig{ Address: arg.Address, Port: arg.Port, - RouteMonitoringPolicy: config.BmpRouteMonitoringPolicyType(arg.Type), + RouteMonitoringPolicy: t, }) } |