Skip to content

Commit

Permalink
Merge pull request #43 from johannesmoos/quote-table-and-proto-names
Browse files Browse the repository at this point in the history
Add quoting for pipe, protocol and table names
  • Loading branch information
annikahannig authored Nov 12, 2021
2 parents dc6f5a7 + 1741164 commit 635e91e
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions bird/bird.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ func RoutesPrefixed(useCache bool, prefix string) (Parsed, bool) {
}

func RoutesProto(useCache bool, protocol string) (Parsed, bool) {
cmd := routesQuery("all protocol " + protocol)
cmd := routesQuery("all protocol '" + protocol + "'")
return RunAndParse(
useCache,
GetCacheKey("RoutesProto", protocol),
Expand All @@ -362,7 +362,7 @@ func RoutesPeer(useCache bool, peer string) (Parsed, bool) {

func RoutesTableAndPeer(useCache bool, table string, peer string) (Parsed, bool) {
table = remapTable(table)
cmd := "route table " + table + " all where from=" + peer
cmd := "route table '" + table + "' all where from=" + peer
return RunAndParse(
useCache,
GetCacheKey("RoutesTableAndPeer", table, peer),
Expand All @@ -372,7 +372,7 @@ func RoutesTableAndPeer(useCache bool, table string, peer string) (Parsed, bool)
}

func RoutesProtoCount(useCache bool, protocol string) (Parsed, bool) {
cmd := routesQuery("protocol " + protocol + " count")
cmd := routesQuery("protocol '" + protocol + "' count")
return RunAndParse(
useCache,
GetCacheKey("RoutesProtoCount", protocol),
Expand All @@ -382,7 +382,7 @@ func RoutesProtoCount(useCache bool, protocol string) (Parsed, bool) {
}

func RoutesProtoPrimaryCount(useCache bool, protocol string) (Parsed, bool) {
cmd := routesQuery("primary protocol " + protocol + " count")
cmd := routesQuery("primary protocol '" + protocol + "' count")
return RunAndParse(
useCache,
GetCacheKey("RoutesProtoPrimaryCount", protocol),
Expand All @@ -393,9 +393,9 @@ func RoutesProtoPrimaryCount(useCache bool, protocol string) (Parsed, bool) {

func PipeRoutesFilteredCount(useCache bool, pipe string, table string, neighborAddress string) (Parsed, bool) {
table = remapTable(table)
cmd := "route table " + table +
" noexport " + pipe +
" where from=" + neighborAddress + " count"
cmd := "route table '" + table +
"' noexport '" + pipe +
"' where from=" + neighborAddress + " count"
return RunAndParse(
useCache,
GetCacheKey("PipeRoutesFilteredCount", table, pipe, neighborAddress),
Expand All @@ -416,7 +416,7 @@ func PipeRoutesFiltered(useCache bool, pipe string, table string) (Parsed, bool)
}

func RoutesFiltered(useCache bool, protocol string) (Parsed, bool) {
cmd := routesQuery("all filtered protocol " + protocol)
cmd := routesQuery("all filtered protocol '" + protocol + "'")
return RunAndParse(
useCache,
GetCacheKey("RoutesFiltered", protocol),
Expand All @@ -426,7 +426,7 @@ func RoutesFiltered(useCache bool, protocol string) (Parsed, bool) {
}

func RoutesExport(useCache bool, protocol string) (Parsed, bool) {
cmd := routesQuery("all export " + protocol)
cmd := routesQuery("all export '" + protocol + "'")
return RunAndParse(
useCache,
GetCacheKey("RoutesExport", protocol),
Expand All @@ -436,7 +436,7 @@ func RoutesExport(useCache bool, protocol string) (Parsed, bool) {
}

func RoutesNoExport(useCache bool, protocol string) (Parsed, bool) {
cmd := routesQuery("all noexport " + protocol)
cmd := routesQuery("all noexport '" + protocol + "'")
return RunAndParse(
useCache,
GetCacheKey("RoutesNoExport", protocol),
Expand All @@ -446,7 +446,7 @@ func RoutesNoExport(useCache bool, protocol string) (Parsed, bool) {
}

func RoutesExportCount(useCache bool, protocol string) (Parsed, bool) {
cmd := routesQuery("export " + protocol + " count")
cmd := routesQuery("export '" + protocol + "' count")
return RunAndParse(
useCache,
GetCacheKey("RoutesExportCount", protocol),
Expand All @@ -457,7 +457,7 @@ func RoutesExportCount(useCache bool, protocol string) (Parsed, bool) {

func RoutesTable(useCache bool, table string) (Parsed, bool) {
table = remapTable(table)
cmd := routesQuery("table " + table + " all")
cmd := routesQuery("table '" + table + "' all")
return RunAndParse(
useCache,
GetCacheKey("RoutesTable", table),
Expand All @@ -468,7 +468,7 @@ func RoutesTable(useCache bool, table string) (Parsed, bool) {

func RoutesTableFiltered(useCache bool, table string) (Parsed, bool) {
table = remapTable(table)
cmd := routesQuery("table " + table + " filtered")
cmd := routesQuery("table '" + table + "' filtered")
return RunAndParse(
useCache,
GetCacheKey("RoutesTableFiltered", table),
Expand All @@ -479,7 +479,7 @@ func RoutesTableFiltered(useCache bool, table string) (Parsed, bool) {

func RoutesTableCount(useCache bool, table string) (Parsed, bool) {
table = remapTable(table)
cmd := routesQuery("table " + table + " count")
cmd := routesQuery("table '" + table + "' count")
return RunAndParse(
useCache,
GetCacheKey("RoutesTableCount", table),
Expand All @@ -491,7 +491,7 @@ func RoutesTableCount(useCache bool, table string) (Parsed, bool) {

func RoutesLookupTable(useCache bool, net string, table string) (Parsed, bool) {
table = remapTable(table)
cmd := routesQuery("for " + net + " table " + table + " all")
cmd := routesQuery("for " + net + " table '" + table + "' all")
return RunAndParse(
useCache,
GetCacheKey("RoutesLookupTable", net, table),
Expand All @@ -501,7 +501,7 @@ func RoutesLookupTable(useCache bool, net string, table string) (Parsed, bool) {
}

func RoutesLookupProtocol(useCache bool, net string, protocol string) (Parsed, bool) {
cmd := routesQuery("for " + net + " protocol " + protocol + " all")
cmd := routesQuery("for " + net + " protocol '" + protocol + "' all")
return RunAndParse(
useCache,
GetCacheKey("RoutesLookupProtocol", net, protocol),
Expand Down

0 comments on commit 635e91e

Please sign in to comment.