summaryrefslogtreecommitdiffhomepage
path: root/cmd
diff options
context:
space:
mode:
authorshao <shaoruntao@netbank.cn>2020-11-11 10:58:37 +0800
committershao <shaoruntao@netbank.cn>2020-11-11 11:25:19 +0800
commit17d0b3cce52bf7009f65e19e7107e152d28fabf5 (patch)
tree259d03a418c8cd9de6896fe6f378def5960ba2f7 /cmd
parentb44362fddd6000842534e1318df3090b23a7cffb (diff)
fix wrong vrf neighbors display
Diffstat (limited to 'cmd')
-rw-r--r--cmd/gobgp/neighbor.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/cmd/gobgp/neighbor.go b/cmd/gobgp/neighbor.go
index 5b0d5012..8c80338b 100644
--- a/cmd/gobgp/neighbor.go
+++ b/cmd/gobgp/neighbor.go
@@ -113,10 +113,21 @@ func counter(p *api.Peer) (uint64, uint64, uint64, error) {
}
func showNeighbors(vrf string) error {
- m, err := getNeighbors("", false)
+ l, err := getNeighbors("", false)
if err != nil {
return err
}
+ m := make([]*api.Peer, 0)
+ if vrf == "" {
+ m = l
+ } else {
+ for _, n := range l {
+ if n.Conf.Vrf == vrf {
+ m = append(m, n)
+ }
+ }
+ }
+
if globalOpts.Json {
j, _ := json.Marshal(m)
fmt.Println(string(j))