diff --git a/bird/bird.go b/bird/bird.go index b9039e0..0867bf3 100644 --- a/bird/bird.go +++ b/bird/bird.go @@ -311,11 +311,11 @@ func Symbols(useCache bool) (Parsed, bool) { func routesQuery(filter string) string { cmd := "route " + filter - if getBirdVersion() < 2 { + + if getBirdVersion() < 2 || ClientConf.Dualstack { return cmd } - // Add ipversion filter return cmd + " where net.type = NET_IP" + IPVersion } diff --git a/bird/config.go b/bird/config.go index 7f2babb..b0f77a4 100644 --- a/bird/config.go +++ b/bird/config.go @@ -14,6 +14,7 @@ type BirdConfig struct { ConfigFilename string `toml:"config"` BirdCmd string `toml:"birdc"` CacheTtl int `toml:"ttl"` + Dualstack bool `toml:"dualstack"` } type ParserConfig struct { diff --git a/bird/parser.go b/bird/parser.go index de47ee2..1e0527b 100644 --- a/bird/parser.go +++ b/bird/parser.go @@ -568,7 +568,7 @@ func parseProtocol(lines string) Parsed { ipVersion = m[1] } - if isCorrectChannel(ipVersion) { + if isCorrectChannel(ipVersion) || ClientConf.Dualstack { parseLine(line, handlers) } } diff --git a/etc/birdwatcher/birdwatcher.conf b/etc/birdwatcher/birdwatcher.conf index ac0bfee..993aaa3 100755 --- a/etc/birdwatcher/birdwatcher.conf +++ b/etc/birdwatcher/birdwatcher.conf @@ -66,12 +66,16 @@ filter_fields = [] enabled = true requests_per_minute = 10 - [bird] listen = "0.0.0.0:29184" config = "/etc/bird.conf" birdc = "birdc" ttl = 5 # time to live (in minutes) for caching of cli output +# When dualstack is set to true, birdwatcher will combine queries for both +# protocol versions into a single API. +# When dualstack is set to false, birdwatcher will use the presence or absense +# of the "-6" CLI flag to set a protocol stack to query for +dualstack = false [bird6] listen = "0.0.0.0:29186"