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

Merge pull request #56 from jof/jof/bird2-dualstack

BIRD 2.x: Support dual-stack route queries
This commit is contained in:
Annika Hannig 2024-09-27 14:15:06 +02:00 committed by GitHub
commit fc141cc3ef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 9 additions and 4 deletions

View file

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

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"