summaryrefslogtreecommitdiffhomepage
path: root/cmd
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@gmail.com>2019-01-26 21:36:39 +0900
committerFUJITA Tomonori <fujita.tomonori@gmail.com>2019-01-26 21:36:39 +0900
commit1e133bd50141bb294dd63cd0f9f70f69c2b60422 (patch)
treeac41f046019b8dbdfbf384e3fc9759e123d25261 /cmd
parent192480fc7127ce0f266407cecceb00703807bbca (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.go7
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})
}