hotfix(routing): ignore non-main table for routes

- When searching for default routes
- When searching for local networks
This commit is contained in:
Quentin McGaw
2023-06-08 19:50:42 +00:00
parent 1c905d0e6f
commit 412921fc1f
2 changed files with 5 additions and 1 deletions

View File

@@ -31,6 +31,10 @@ func (r *Routing) DefaultRoutes() (defaultRoutes []DefaultRoute, err error) {
}
for _, route := range routes {
if route.Table != 0 {
// ignore non-main table
continue
}
if route.Dst.IsValid() {
continue
}

View File

@@ -47,7 +47,7 @@ func (r *Routing) LocalNetworks() (localNetworks []LocalNetwork, err error) {
}
for _, route := range routes {
if route.Gw.IsValid() || !route.Dst.IsValid() {
if route.Table != 0 || route.Gw.IsValid() || !route.Dst.IsValid() {
continue
} else if _, ok := localLinks[route.LinkIndex]; !ok {
continue