IPAE: DNS lookup provides subnet mask as well as IP

If the user types in a name in the IP Address Entry form,
       also replace the subnet mask.

       This is particularly useful for pinging, since ping doesn't
       allow access to the subnet mask field, and if an inappropriate
       mask is autoIP-entered, then the results might be unexpected.

       Exception for DHCP ranges: Actually, it shouldn't be necessary
       (since the IP address field is disabled for DHCP), but just
       for completeness, I ensure that the second field is not altered
       for DHCP range entries.

       Scenario: Level4, Small Subnets
       1.) fix router2, so the subnet mask is /30
       2.) from pc1, ping pc2 (which is address 192.168.1.3)
                       -lastIP sets subnet mask to 255.255.255.252
                       -that makes .3 the broadcast address
       -fix result: lastIP mask is replaced by pc2's real mask.
This commit is contained in:
Tim Young 2019-02-27 10:16:59 -06:00
parent 2a17fba36c
commit 9bf9d58c48
1 changed files with 3 additions and 1 deletions

View File

@ -249,9 +249,11 @@ namespace EduNetworkBuilder
{
tIPAddress = mynet.DNSLookup(ParentDevice, tbIPAddress.Text);
}
if(tIPAddress != null)
if (tIPAddress != null) //device name used, convert to IP address and netmask
{
taddress = tIPAddress.GetIP;
if (DHCPInterface == null)
tbNetmask.Text = tIPAddress.GetMaskString;
}
else
taddress = tbIPAddress.Text.ParseIp();