summaryrefslogtreecommitdiffhomepage
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/gobgp/rpki.go10
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
}