Skip to content

Commit

Permalink
Proper ignore IPv6 announcements when IPv6 is not requested
Browse files Browse the repository at this point in the history
  • Loading branch information
rikatz committed Oct 31, 2024
1 parent b3d9fca commit 1cb8a74
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/providers/vsphere/network/netplan.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type NetplanEthernet struct {
SetName string `json:"set-name,omitempty"`
Dhcp4 bool `json:"dhcp4,omitempty"`
Dhcp6 bool `json:"dhcp6,omitempty"`
AcceptRA bool `json:"accept-ra,omitempty"`
Addresses []string `json:"addresses,omitempty"`
Gateway4 string `json:"gateway4,omitempty"`
Gateway6 string `json:"gateway6,omitempty"`
Expand Down Expand Up @@ -64,6 +65,9 @@ func NetPlanCustomization(result NetworkInterfaceResults) (*Netplan, error) {

npEth.Dhcp4 = r.DHCP4
npEth.Dhcp6 = r.DHCP6
// Right now we can set the same value as DHCPv6 configuration
// and in some future separate/specialize if required
npEth.AcceptRA = r.DHCP6

if !npEth.Dhcp4 {
for _, ipConfig := range r.IPConfigs {
Expand Down
2 changes: 2 additions & 0 deletions pkg/providers/vsphere/network/netplan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ var _ = Describe("Netplan", func() {
Expect(np.SetName).To(Equal(guestDevName))
Expect(np.Dhcp4).To(BeFalse())
Expect(np.Dhcp6).To(BeFalse())
Expect(np.AcceptRA).To(BeFalse())
Expect(np.Addresses).To(HaveLen(2))
Expect(np.Addresses[0]).To(Equal(ipv4CIDR))
Expect(np.Addresses[1]).To(Equal(ipv6 + fmt.Sprintf("/%d", ipv6Subnet)))
Expand Down Expand Up @@ -139,6 +140,7 @@ var _ = Describe("Netplan", func() {
Expect(np.SetName).To(Equal(guestDevName))
Expect(np.Dhcp4).To(BeTrue())
Expect(np.Dhcp6).To(BeTrue())
Expect(np.AcceptRA).To(BeTrue())
Expect(np.MTU).To(BeEquivalentTo(9000))
Expect(np.Nameservers.Addresses).To(Equal([]string{dnsServer1}))
Expect(np.Nameservers.Search).To(Equal([]string{searchDomain1}))
Expand Down

0 comments on commit 1cb8a74

Please sign in to comment.