diff options
author | FUJITA Tomonori <fujita.tomonori@gmail.com> | 2019-01-26 21:36:39 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@gmail.com> | 2019-01-26 21:36:39 +0900 |
commit | 1e133bd50141bb294dd63cd0f9f70f69c2b60422 (patch) | |
tree | ac41f046019b8dbdfbf384e3fc9759e123d25261 /cmd | |
parent | 192480fc7127ce0f266407cecceb00703807bbca (diff) |
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 <fujita.tomonori@gmail.com>
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/gobgp/neighbor.go | 7 |
1 files changed, 6 insertions, 1 deletions
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}) } |