From 1c8da637d4d730b268becb6b87efadc5c0872f53 Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Sun, 6 Oct 2019 21:49:44 +0900 Subject: gobgp: fix rpki table printing Signed-off-by: FUJITA Tomonori --- cmd/gobgp/rpki.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'cmd') 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 } -- cgit v1.2.3