summaryrefslogtreecommitdiffhomepage
path: root/internal
diff options
context:
space:
mode:
authorSerguei Bezverkhi <sbezverk@cisco.com>2020-02-07 19:09:35 -0500
committerFUJITA Tomonori <fujita.tomonori@gmail.com>2020-02-08 21:00:51 +0900
commit46401a2099d82b03cacf0521174b61406c49c439 (patch)
tree4a1286d73414f472e50ae4848edb39191ae2a738 /internal
parent7581d9a3a5845acea6a4d8966a8015a69ba2ba39 (diff)
fix panic in Family == nil
Signed-off-by: Serguei Bezverkhi <sbezverk@cisco.com>
Diffstat (limited to 'internal')
-rw-r--r--internal/pkg/apiutil/util.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/internal/pkg/apiutil/util.go b/internal/pkg/apiutil/util.go
index 1dd25c79..7eb3ee86 100644
--- a/internal/pkg/apiutil/util.go
+++ b/internal/pkg/apiutil/util.go
@@ -17,6 +17,7 @@ package apiutil
import (
"encoding/json"
+ "fmt"
"net"
"time"
@@ -90,6 +91,9 @@ func getNLRI(family bgp.RouteFamily, buf []byte) (bgp.AddrPrefixInterface, error
}
func GetNativeNlri(p *api.Path) (bgp.AddrPrefixInterface, error) {
+ if p.Family == nil {
+ return nil, fmt.Errorf("family cannot be nil")
+ }
if len(p.NlriBinary) > 0 {
return getNLRI(ToRouteFamily(p.Family), p.NlriBinary)
}