summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--api/grpc_server.go2
-rw-r--r--gobgp/cmd/global.go2
2 files changed, 2 insertions, 2 deletions
diff --git a/api/grpc_server.go b/api/grpc_server.go
index f9bdaf6a..a6306580 100644
--- a/api/grpc_server.go
+++ b/api/grpc_server.go
@@ -573,7 +573,7 @@ func (s *Server) api2PathList(resource Resource, ApiPathList []*Path) ([]*table.
return nil, fmt.Errorf("not found nlri or nexthop")
}
- if resource != Resource_VRF && bgp.RouteFamily(path.Family) == bgp.RF_IPv4_UC {
+ if resource != Resource_VRF && bgp.RouteFamily(path.Family) == bgp.RF_IPv4_UC && net.ParseIP(nexthop).To4() != nil {
pattr = append(pattr, bgp.NewPathAttributeNextHop(nexthop))
} else {
pattr = append(pattr, bgp.NewPathAttributeMpReachNLRI(nexthop, []bgp.AddrPrefixInterface{nlri}))
diff --git a/gobgp/cmd/global.go b/gobgp/cmd/global.go
index 0c771080..c7d07db1 100644
--- a/gobgp/cmd/global.go
+++ b/gobgp/cmd/global.go
@@ -797,7 +797,7 @@ func ParsePath(rf bgp.RouteFamily, args []string) (*table.Path, error) {
return nil, err
}
- if rf == bgp.RF_IPv4_UC {
+ if rf == bgp.RF_IPv4_UC && net.ParseIP(nexthop).To4() != nil {
attrs = append(attrs, bgp.NewPathAttributeNextHop(nexthop))
} else {
mpreach := bgp.NewPathAttributeMpReachNLRI(nexthop, []bgp.AddrPrefixInterface{nlri})