Skip to content

Commit f3a6701

Browse files
authored
Fix running Confidential ContainerPlat
1 parent b729453 commit f3a6701

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

internal/uvm/network.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ var (
3939
ErrNICNotFound = errors.New("NIC not found in network namespace")
4040
)
4141

42+
const (
43+
ipv4GwDestination = "0.0.0.0/0"
44+
ipv4EmptyGw = "0.0.0.0"
45+
ipv6GwDestination = "::/0"
46+
ipv6EmptyGw = "::"
47+
)
48+
4249
func sortEndpoints(endpoints []*hcn.HostComputeEndpoint) {
4350
cmp := func(a, b *hcn.HostComputeEndpoint) int {
4451
if strings.HasSuffix(a.Name, "eth0") {
@@ -573,6 +580,15 @@ func convertToLCOWReq(id string, endpoint *hcn.HostComputeEndpoint, policyBasedR
573580
}
574581

575582
for _, r := range endpoint.Routes {
583+
584+
if (r.DestinationPrefix == ipv4GwDestination || r.DestinationPrefix == ipv6GwDestination) &&
585+
r.NextHop == "" {
586+
// This is the default route
587+
// But NextHop should either specify a gateway or be equal to 0.0.0.0 to be on-link
588+
// The fact that it's empty makes this an invalid route
589+
continue
590+
}
591+
576592
newRoute := guestresource.LCOWRoute{
577593
DestinationPrefix: r.DestinationPrefix,
578594
NextHop: r.NextHop,

0 commit comments

Comments
 (0)