diff --git a/VERSION b/VERSION index 84298f9..e6a68e9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.7.8 +1.7.12 diff --git a/bird/bird.go b/bird/bird.go index 41c6028..3000823 100644 --- a/bird/bird.go +++ b/bird/bird.go @@ -159,7 +159,6 @@ func ProtocolsBgp() (Parsed, bool) { } } - return Parsed{"protocols": bgpProto, "ttl": p["ttl"]}, from_cache } @@ -182,7 +181,7 @@ func RoutesProtoCount(protocol string) (Parsed, bool) { } func RoutesFiltered(protocol string) (Parsed, bool) { - return RunAndParse("route protocol '"+protocol+"' filtered", parseRoutes) + return RunAndParse("route filtered protocol '"+protocol+"' all", parseRoutes) } func RoutesExport(protocol string) (Parsed, bool) { diff --git a/bird/parser.go b/bird/parser.go index 2173cbe..02d4391 100644 --- a/bird/parser.go +++ b/bird/parser.go @@ -131,8 +131,9 @@ func parseRoutes(input []byte) Parsed { second_rx := regexp.MustCompile(`^\s+via\s+([0-9a-f\.\:]+)\s+on\s+([\w+)\s+\[([\w\.]+)\s+([0-9\-\:\s]+)(?:\s+from\s+([0-9a-f\.\:\/]+)){0,1}\]\s+(?:(\*)\s+){0,1}\((\d+)(?:\/\d+){0,1}\).*$`) type_rx := regexp.MustCompile(`^\s+Type:\s+(.*)\s*$`) bgp_rx := regexp.MustCompile(`^\s+BGP.(\w+):\s+(.+)\s*$`) - community_rx := regexp.MustCompile(`^\((\d+),(\d+)\)`) - large_community_rx := regexp.MustCompile(`^\((\d+),(\d+),(\d+)\)`) + community_rx := regexp.MustCompile(`^\((\d+),\s*(\d+)\)`) + large_community_rx := regexp.MustCompile(`^\((\d+),\s*(\d+),\s*(\d+)\)`) + paren_rx := regexp.MustCompile(`\([^\(]*\)\s*`) for _, line := range lines { if specialLine(line) || (len(route) == 0 && emptyLine(line)) { continue @@ -178,7 +179,7 @@ func parseRoutes(input []byte) Parsed { if groups[1] == "community" { communities := [][]int64{} - for _, community := range strings.Split(groups[2], " ") { + for _, community := range paren_rx.FindAllString(groups[2], -1) { if community_rx.MatchString(community) { com_groups := community_rx.FindStringSubmatch(community) maj := parseInt(com_groups[1]) @@ -189,7 +190,7 @@ func parseRoutes(input []byte) Parsed { bgp["communities"] = communities } else if groups[1] == "large_community" { communities := [][]int64{} - for _, community := range strings.Split(groups[2], " ") { + for _, community := range paren_rx.FindAllString(groups[2], -1) { if large_community_rx.MatchString(community) { com_groups := large_community_rx.FindStringSubmatch(community) maj := parseInt(com_groups[1]) diff --git a/birdwatcher.go b/birdwatcher.go index 7554f50..901534b 100644 --- a/birdwatcher.go +++ b/birdwatcher.go @@ -13,7 +13,7 @@ import ( ) //go:generate versionize -var VERSION = "1.7.8" +var VERSION = "1.7.11" func isModuleEnabled(module string, modulesEnabled []string) bool { for _, enabled := range modulesEnabled {