Merge pull request #57 from amshinde/skip-ipv6-gateway

Skip routes with ipv6 gateway
This commit is contained in:
Sebastien Boeuf 2018-03-16 10:33:55 -07:00 committed by GitHub
commit d1bdf80f56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 3 deletions

View File

@ -143,6 +143,12 @@ func (h *hyper) processHyperRoute(route netlink.Route, deviceName string) *hyper
gateway := route.Gw.String() gateway := route.Gw.String()
if gateway == "<nil>" { if gateway == "<nil>" {
gateway = "" gateway = ""
} else if route.Gw.To4() == nil { // Skip IPv6 as it is not supported by hyperstart agent
h.Logger().WithFields(logrus.Fields{
"unsupported-route-type": "ipv6",
"gateway": gateway,
}).Warn("unsupported route")
return nil
} }
var destination string var destination string

View File

@ -27,11 +27,11 @@ import (
"strings" "strings"
"syscall" "syscall"
kataclient "github.com/kata-containers/agent/protocols/client"
"github.com/kata-containers/agent/protocols/grpc"
vcAnnotations "github.com/kata-containers/runtime/virtcontainers/pkg/annotations" vcAnnotations "github.com/kata-containers/runtime/virtcontainers/pkg/annotations"
ns "github.com/kata-containers/runtime/virtcontainers/pkg/nsenter" ns "github.com/kata-containers/runtime/virtcontainers/pkg/nsenter"
"github.com/kata-containers/runtime/virtcontainers/pkg/uuid" "github.com/kata-containers/runtime/virtcontainers/pkg/uuid"
kataclient "github.com/kata-containers/agent/protocols/client"
"github.com/kata-containers/agent/protocols/grpc"
"github.com/opencontainers/runtime-spec/specs-go" "github.com/opencontainers/runtime-spec/specs-go"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )
@ -378,7 +378,17 @@ func (k *kataAgent) generateInterfacesAndRoutes(networkNS NetworkNamespace) ([]*
} }
if route.Gw != nil { if route.Gw != nil {
r.Gateway = route.Gw.String() gateway := route.Gw.String()
if route.Gw.To4() == nil {
// Skip IPv6 because is is not supported
k.Logger().WithFields(logrus.Fields{
"unsupported-route-type": "ipv6",
"gateway": gateway,
}).Warn("unsupported route")
continue
}
r.Gateway = gateway
} }
if route.Src != nil { if route.Src != nil {