fix(routing): only set routes for IPv4 default routes

This commit is contained in:
Quentin McGaw
2022-03-13 14:40:17 +00:00
parent 82d42297e8
commit ace5e97e68
2 changed files with 15 additions and 2 deletions

View File

@@ -20,6 +20,7 @@ type DefaultRoute struct {
NetInterface string
Gateway net.IP
AssignedIP net.IP
Family int
}
func (d DefaultRoute) String() string {
@@ -37,6 +38,7 @@ func (r *Routing) DefaultRoutes() (defaultRoutes []DefaultRoute, err error) {
if route.Dst == nil {
defaultRoute := DefaultRoute{
Gateway: route.Gw,
Family: route.Family,
}
linkIndex := route.LinkIndex
link, err := r.netLinker.LinkByIndex(linkIndex)