From b725f7658f746b085f0a25596571cd643041bf5b Mon Sep 17 00:00:00 2001 From: Kyriakos Oikonomakos Date: Wed, 27 Jan 2021 17:19:39 +0000 Subject: [PATCH] Add validation for netmask length Ensures a network mask's length will never exceed 32 for IPv4 and 128 for IPv6. --- .../vmworkflow/virtual_machine_customize_subresource.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/vsphere/internal/vmworkflow/virtual_machine_customize_subresource.go b/vsphere/internal/vmworkflow/virtual_machine_customize_subresource.go index 7eb1df8c7..2051ecad9 100644 --- a/vsphere/internal/vmworkflow/virtual_machine_customize_subresource.go +++ b/vsphere/internal/vmworkflow/virtual_machine_customize_subresource.go @@ -230,9 +230,10 @@ func VirtualMachineCustomizeSchema() map[string]*schema.Schema { Description: "The IPv4 address assigned to this network adapter. If left blank, DHCP is used.", }, "ipv4_netmask": { - Type: schema.TypeInt, - Optional: true, - Description: "The IPv4 CIDR netmask for the supplied IP address. Ignored if DHCP is selected.", + Type: schema.TypeInt, + Optional: true, + Description: "The IPv4 CIDR netmask for the supplied IP address. Ignored if DHCP is selected.", + ValidateFunc: validation.IntAtMost(32), }, "ipv6_address": { Type: schema.TypeString,