diff options
Diffstat (limited to 'internal')
-rw-r--r-- | internal/pkg/apiutil/attribute.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/internal/pkg/apiutil/attribute.go b/internal/pkg/apiutil/attribute.go index 48463a0c..1610a181 100644 --- a/internal/pkg/apiutil/attribute.go +++ b/internal/pkg/apiutil/attribute.go @@ -45,7 +45,9 @@ func UnmarshalAttribute(an *any.Any) (bgp.PathAttributeInterface, error) { case *api.NextHopAttribute: nexthop := net.ParseIP(a.NextHop).To4() if nexthop == nil { - return nil, fmt.Errorf("invalid nexthop address: %s", a.NextHop) + if nexthop = net.ParseIP(a.NextHop).To16(); nexthop == nil { + return nil, fmt.Errorf("invalid nexthop address: %s", a.NextHop) + } } return bgp.NewPathAttributeNextHop(a.NextHop), nil case *api.MultiExitDiscAttribute: @@ -1363,7 +1365,9 @@ func unmarshalAttribute(an *any.Any) (bgp.PathAttributeInterface, error) { case *api.NextHopAttribute: nexthop := net.ParseIP(a.NextHop).To4() if nexthop == nil { - return nil, fmt.Errorf("invalid nexthop address: %s", a.NextHop) + if nexthop = net.ParseIP(a.NextHop).To16(); nexthop == nil { + return nil, fmt.Errorf("invalid nexthop address: %s", a.NextHop) + } } return bgp.NewPathAttributeNextHop(a.NextHop), nil case *api.MultiExitDiscAttribute: |