Skip to content

Commit

Permalink
network/netplan: adjust link-local accordingly (#443)
Browse files Browse the repository at this point in the history
Adjust the netplan's link-local configuration key accordingly with
instance's enabled stack.

In general default values should be fine for most of netplan + networkd
versions combinations, however, in debian-12 we've seen failures where
the network interface will randomly not be available if the stacks are
not properly adjusted.
  • Loading branch information
dorileo authored Oct 8, 2024
1 parent cdb37f8 commit 2a9cb58
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions google_guest_agent/network/manager/netplan_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ type netplanEthernet struct {
DHCPv6 *bool `yaml:"dhcp6,omitempty"`

DHCP6Overrides *netplanDHCPOverrides `yaml:"dhcp6-overrides,omitempty"`

// LinkLocal defines the stack to be used for link local i.e: ipv4, ipv6 etc.
LinkLocal []string `yaml:"link-local,omitempty"`
}

// netplanDHCPOverrides sets the netplan dhcp-overrides configuration.
Expand Down Expand Up @@ -348,6 +351,7 @@ func (n *netplan) writeNetplanEthernetDropin(mtuMap map[string]int, interfaces,
DHCP4Overrides: &netplanDHCPOverrides{
UseDomains: shouldUseDomains(i),
},
LinkLocal: []string{"ipv4"},
}

if mtu, found := mtuMap[iface]; found {
Expand All @@ -359,6 +363,7 @@ func (n *netplan) writeNetplanEthernetDropin(mtuMap map[string]int, interfaces,
ne.DHCP6Overrides = &netplanDHCPOverrides{
UseDomains: shouldUseDomains(i),
}
ne.LinkLocal = append(ne.LinkLocal, "ipv6")
}

key := n.ID(iface)
Expand Down

0 comments on commit 2a9cb58

Please sign in to comment.