1
0
Fork 0
mirror of https://github.com/alice-lg/birdwatcher.git synced 2025-03-09 00:00:05 +01:00

Add a dualstack config option to enable dualstack BIRD 2.x operation

This commit is contained in:
Jonathan Lassoff 2024-02-12 21:17:13 -08:00
parent a78ad8c83e
commit ca2cbd9f0e
4 changed files with 13 additions and 3 deletions

View file

@ -311,7 +311,12 @@ func Symbols(useCache bool) (Parsed, bool) {
func routesQuery(filter string) string {
cmd := "route " + filter
return cmd
if getBirdVersion() < 2 || ClientConf.Dualstack {
return cmd
}
return cmd + " where net.type = NET_IP" + IPVersion
}
func remapTable(table string) string {

View file

@ -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 {

View file

@ -568,7 +568,7 @@ func parseProtocol(lines string) Parsed {
ipVersion = m[1]
}
if isCorrectChannel(ipVersion) {
if isCorrectChannel(ipVersion) || ClientConf.Dualstack {
parseLine(line, handlers)
}
}

View file

@ -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"