diff options
author | Thomas Rosenstein <thomas.rosenstein@creamfinance.com> | 2019-02-12 11:18:57 +0100 |
---|---|---|
committer | Thomas Rosenstein <thomas.rosenstein@creamfinance.com> | 2019-02-12 11:18:57 +0100 |
commit | a22897a0afcff265099c69607212cff8edf13332 (patch) | |
tree | 99e9b56722e26135b48e9be18672e91e3245b546 /cmd | |
parent | e87bfcba68f4b5a6673162a3f9b6219f45ada38a (diff) |
[Fix #1967] Fix print statement
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/gobgp/policy.go | 48 |
1 files changed, 32 insertions, 16 deletions
diff --git a/cmd/gobgp/policy.go b/cmd/gobgp/policy.go index 551b3ba9..0feddda9 100644 --- a/cmd/gobgp/policy.go +++ b/cmd/gobgp/policy.go @@ -488,21 +488,29 @@ func printStatement(indent int, s *api.Statement) { c := s.Conditions if c.PrefixSet != nil { fmt.Printf("%sPrefixSet: %s \n", ind, prettyString(c.PrefixSet)) - } else if c.NeighborSet != nil { + } + if c.NeighborSet != nil { fmt.Printf("%sNeighborSet: %s\n", ind, prettyString(c.NeighborSet)) - } else if c.AsPathSet != nil { + } + if c.AsPathSet != nil { fmt.Printf("%sAsPathSet: %s \n", ind, prettyString(c.AsPathSet)) - } else if c.CommunitySet != nil { + } + if c.CommunitySet != nil { fmt.Printf("%sCommunitySet: %s\n", ind, prettyString(c.CommunitySet)) - } else if c.ExtCommunitySet != nil { + } + if c.ExtCommunitySet != nil { fmt.Printf("%sExtCommunitySet: %s\n", ind, prettyString(c.ExtCommunitySet)) - } else if c.LargeCommunitySet != nil { + } + if c.LargeCommunitySet != nil { fmt.Printf("%sLargeCommunitySet: %s\n", ind, prettyString(c.LargeCommunitySet)) - } else if c.NextHopInList != nil { + } + if c.NextHopInList != nil { fmt.Printf("%sNextHopInList: %s\n", ind, "[ "+strings.Join(c.NextHopInList, ", ")+" ]") - } else if c.AsPathLength != nil { + } + if c.AsPathLength != nil { fmt.Printf("%sAsPathLength: %s\n", ind, prettyString(c.AsPathLength)) - } else if c.RpkiResult != -1 { + } + if c.RpkiResult != -1 { var result string switch c.RpkiResult { case 0: @@ -515,9 +523,11 @@ func printStatement(indent int, s *api.Statement) { result = "not-found" } fmt.Printf("%sRPKI result: %s\n", ind, result) - } else if c.RouteType != api.Conditions_ROUTE_TYPE_NONE { + } + if c.RouteType != api.Conditions_ROUTE_TYPE_NONE { fmt.Printf("%sRoute Type: %s\n", ind, routeTypePrettyString(c.RouteType)) - } else if c.AfiSafiIn != nil { + } + if c.AfiSafiIn != nil { fmt.Printf("%sAFI SAFI In: %s\n", ind, c.AfiSafiIn) } @@ -525,17 +535,23 @@ func printStatement(indent int, s *api.Statement) { a := s.Actions if a.Community != nil { fmt.Println(ind, "Community: ", prettyString(a.Community)) - } else if a.ExtCommunity != nil { + } + if a.ExtCommunity != nil { fmt.Println(ind, "ExtCommunity: ", prettyString(a.ExtCommunity)) - } else if a.LargeCommunity != nil { + } + if a.LargeCommunity != nil { fmt.Println(ind, "LargeCommunity: ", prettyString(a.LargeCommunity)) - } else if a.Med != nil { + } + if a.Med != nil { fmt.Println(ind, "MED: ", prettyString(a.Med)) - } else if a.LocalPref != nil { + } + if a.LocalPref != nil { fmt.Println(ind, "LocalPref: ", prettyString(a.LocalPref)) - } else if a.AsPrepend != nil { + } + if a.AsPrepend != nil { fmt.Println(ind, "ASPathPrepend: ", prettyString(a.AsPrepend)) - } else if a.Nexthop != nil { + } + if a.Nexthop != nil { fmt.Println(ind, "Nexthop: ", prettyString(a.Nexthop)) } |