Skip to content

Commit eaaad7c

Browse files
authored
Fix maximum subnetport number in a subnet (vmware-tanzu#783)
Signed-off-by: Yanjun Zhou <[email protected]>
1 parent 6202688 commit eaaad7c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pkg/controllers/common/utils.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ func AllocateSubnetFromSubnetSet(subnetSet *v1alpha1.SubnetSet, vpcService servi
3636
// totalIP will be overrided if IpAddresses are specified.
3737
totalIP, _ = util.CalculateIPFromCIDRs(nsxSubnet.IpAddresses)
3838
}
39-
if portNums < totalIP-3 {
39+
// NSX reserves 4 ip addresses in each subnet for network address, gateway address,
40+
// dhcp server address and broadcast address.
41+
if portNums < totalIP-4 {
4042
return *nsxSubnet.Path, nil
4143
}
4244
}

0 commit comments

Comments
 (0)