From 448160257ea6ad41ab56a12a5a1edb5e0515cef6 Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Sun, 19 Mar 2017 23:31:48 +0900 Subject: table: handle IPv4-Mapped IPv6 Address as v6 Currently, Prefix structure wrongly handles IPv4-Mapped IPv6 Address as v4. Signed-off-by: FUJITA Tomonori --- api/grpc_server.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'api') diff --git a/api/grpc_server.go b/api/grpc_server.go index f167c13f..9fc66bde 100644 --- a/api/grpc_server.go +++ b/api/grpc_server.go @@ -1001,12 +1001,12 @@ func (s *Server) DeleteNeighbor(ctx context.Context, arg *DeleteNeighborRequest) } func NewPrefixFromApiStruct(a *Prefix) (*table.Prefix, error) { - addr, prefix, err := net.ParseCIDR(a.IpPrefix) + _, prefix, err := net.ParseCIDR(a.IpPrefix) if err != nil { return nil, err } rf := bgp.RF_IPv4_UC - if addr.To4() == nil { + if strings.Contains(a.IpPrefix, ":") { rf = bgp.RF_IPv6_UC } return &table.Prefix{ -- cgit v1.2.3