diff options
author | FUJITA Tomonori <fujita.tomonori@gmail.com> | 2019-10-06 21:49:44 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@gmail.com> | 2019-10-06 21:49:44 +0900 |
commit | 1c8da637d4d730b268becb6b87efadc5c0872f53 (patch) | |
tree | 34f62befc171e1e4a74107110eebd75160af2b56 /cmd | |
parent | 0da37b02108d79fc902d1d6731c9245ff733dc84 (diff) |
gobgp: fix rpki table printing
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/gobgp/rpki.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/cmd/gobgp/rpki.go b/cmd/gobgp/rpki.go index c5da682f..de6f16a2 100644 --- a/cmd/gobgp/rpki.go +++ b/cmd/gobgp/rpki.go @@ -118,7 +118,15 @@ func showRPKITable(args []string) error { if len(args) > 0 && args[0] != r.Conf.Address { continue } - fmt.Printf(format, r.Prefix, fmt.Sprint(r.Maxlen), fmt.Sprint(r.As), net.JoinHostPort(r.Conf.Address, strconv.Itoa(int(r.Conf.RemotePort)))) + bits := net.IPv4len * 8 + if family.Afi == api.Family_AFI_IP6 { + bits = net.IPv6len * 8 + } + n := net.IPNet{ + IP: net.ParseIP(r.GetPrefix()), + Mask: net.CIDRMask(int(r.GetPrefixlen()), bits), + } + fmt.Printf(format, n.String(), fmt.Sprint(r.Maxlen), fmt.Sprint(r.As), net.JoinHostPort(r.Conf.Address, strconv.Itoa(int(r.Conf.RemotePort)))) } return nil } |