1

Closed

IPAddressCollection improperly returns the number addresses in a /32 network

description

consider this test:

[TestMethod]
        public void TestEnumeratorIterate1()
        {

            IPNetwork ipn = IPNetwork.Parse("192.168.1.0/32");
            IEnumerator ips = IPNetwork.ListIPAddress(ipn);
            while (ips.MoveNext())
            {
                Assert.IsNotNull(ips.Current);
            }
        }
This is how i fixed it:
IPAddressCollection.cs: line 28

public double Count {
            get {
                if (this._ipnetwork.Netmask.ToString() == "255.255.255.255")
                {
                    return this._ipnetwork.Usable + 1;
                }
                else
                {
                    return this._ipnetwork.Usable + 2;
                }
            }
        }
Closed Apr 22, 2014 at 7:42 AM by LukeSkywalker
Fixed in 1.3.2

comments