From 1e133bd50141bb294dd63cd0f9f70f69c2b60422 Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Sat, 26 Jan 2019 21:36:39 +0900 Subject: gobgp: fix vrf rib command crash showNeighborRib() executes net.ParseCIDR() for vrf prefix like 10.100:100:10.0.0.0/24 and then crashes. Probably ListRib() API should support an option to return sorted destinations. Signed-off-by: FUJITA Tomonori --- cmd/gobgp/neighbor.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'cmd') diff --git a/cmd/gobgp/neighbor.go b/cmd/gobgp/neighbor.go index 90d9e4f8..9ebbff67 100644 --- a/cmd/gobgp/neighbor.go +++ b/cmd/gobgp/neighbor.go @@ -943,7 +943,12 @@ func showNeighborRib(r string, name string, args []string) error { } l := make([]*d, 0, len(rib)) for _, dst := range rib { - _, p, _ := net.ParseCIDR(dst.Prefix) + prefix := dst.Prefix + if t == api.TableType_VRF { + s := strings.Split(prefix, ":") + prefix = s[len(s)-1] + } + _, p, _ := net.ParseCIDR(prefix) l = append(l, &d{prefix: p.IP, dst: dst}) } -- cgit v1.2.3