diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/grpc_server.go | 3 | ||||
-rw-r--r-- | server/server.go | 7 |
2 files changed, 10 insertions, 0 deletions
diff --git a/server/grpc_server.go b/server/grpc_server.go index 79a3dc4d..19a2ba28 100644 --- a/server/grpc_server.go +++ b/server/grpc_server.go @@ -68,6 +68,9 @@ const ( const GRPC_PORT = 8080 func convertAf2Rf(af *api.AddressFamily) (bgp.RouteFamily, error) { + if af == nil { + return bgp.RouteFamily(0), fmt.Errorf("address family is nil") + } if af.Equal(api.AF_IPV4_UC) { return bgp.RF_IPv4_UC, nil } else if af.Equal(api.AF_IPV6_UC) { diff --git a/server/server.go b/server/server.go index e15e1360..105cdccb 100644 --- a/server/server.go +++ b/server/server.go @@ -1384,6 +1384,13 @@ func (server *BgpServer) handleGrpc(grpcReq *GrpcRequest) []*SenderMsg { server.handlePolicy(server.routingPolicy) grpcReq.ResponseCh <- result close(grpcReq.ResponseCh) + default: + errmsg := "Unknown request type" + result := &GrpcResponse{ + ResponseErr: fmt.Errorf(errmsg), + } + grpcReq.ResponseCh <- result + close(grpcReq.ResponseCh) } return msgs } |