diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2017-03-19 23:31:48 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2017-03-19 23:31:48 +0900 |
commit | 448160257ea6ad41ab56a12a5a1edb5e0515cef6 (patch) | |
tree | 19f98a739d1c88c48d3401599785bec77334587b /api/grpc_server.go | |
parent | be6a0dbe869766e5ba6c818eb2cdd8bd6e580d67 (diff) |
table: handle IPv4-Mapped IPv6 Address as v6
Currently, Prefix structure wrongly handles IPv4-Mapped IPv6 Address
as v4.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'api/grpc_server.go')
-rw-r--r-- | api/grpc_server.go | 4 |
1 files changed, 2 insertions, 2 deletions
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{ |