From 1cb8a74610d64dcf81732872f7c8dd803b2f1dc0 Mon Sep 17 00:00:00 2001 From: Ricardo Katz Date: Thu, 31 Oct 2024 16:18:57 -0300 Subject: [PATCH] Proper ignore IPv6 announcements when IPv6 is not requested --- pkg/providers/vsphere/network/netplan.go | 4 ++++ pkg/providers/vsphere/network/netplan_test.go | 2 ++ 2 files changed, 6 insertions(+) diff --git a/pkg/providers/vsphere/network/netplan.go b/pkg/providers/vsphere/network/netplan.go index b4e9676cb..979e7957d 100644 --- a/pkg/providers/vsphere/network/netplan.go +++ b/pkg/providers/vsphere/network/netplan.go @@ -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"` @@ -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 { diff --git a/pkg/providers/vsphere/network/netplan_test.go b/pkg/providers/vsphere/network/netplan_test.go index 5e93d35b3..b875548e2 100644 --- a/pkg/providers/vsphere/network/netplan_test.go +++ b/pkg/providers/vsphere/network/netplan_test.go @@ -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))) @@ -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}))