Skip to content

Bitvantage.InternetProtocol.IPNetworkExtensions 1.1.1

Latest

Choose a tag to compare

@Bitvantage Bitvantage released this 12 Nov 15:14

IPNetwork.GetPrefixLengthForSubnets now gives an answer for an empty list instead of throwing, like the other sizing methods do for zero. Nothing else changes, so code written for 1.1.0 builds unchanged.

dotnet add package Bitvantage.InternetProtocol.IPNetworkExtensions --version 1.1.1

Changed

  • IPNetwork.GetPrefixLengthForSubnets gives a host network, /32 or /128, for an empty list of prefix lengths, where 1.1.0 threw an ArgumentException. That matches GetPrefixLengthForAddresses and GetPrefixLengthForHosts, which give a host network for zero, and the host network holds the empty plan, which AllocateSubnets accepts. A plan built from a list that filters down to nothing now flows through sizing and allocation without a special case.
IPNetwork.GetPrefixLengthForSubnets(IPVersion.IPv4, []);   // 32
IPNetwork.GetPrefixLengthForSubnets(IPVersion.IPv6, []);   // 128

See the changelog for more.