Fix a dhcp bug with WirelessRouters. Needed better wisdom for returning the appropriate gateway in different modes.

This commit is contained in:
Tim Young 2017-10-05 11:06:59 -05:00
parent a6db4a82be
commit 27d3b88083

View File

@ -2977,7 +2977,26 @@ namespace EduNetworkBuilder
public IPAddress LookupDHCPLease(string MAC, IPAddress NIC_IP)
{
IPAddress gateway;
if (myType != NetworkComponentType.firewall)
NetworkComponentType NCT = myType;
if(myType == NetworkComponentType.wrouter)
{
//If we are a wireless router, we could be set up as an access point, or as a router/firewall
//If the default gateway is on the LAN, we use the gateway. If the default gateway is on the WAN,
//We use the IP of the firewall IP. (NIC_IP)
IPAddress tGateway = GetGateway();
NetworkCard lNic = LocalNic(tGateway);
if(lNic != null && lNic.GetNicType == NicType.wan)
{
//The gateway is on the WAN. We will give it our own IP as if we are a firewall
NCT = NetworkComponentType.firewall;
}
else
{
//The gateway is on the LAN. We pretend we are an Access Point.
NCT = NetworkComponentType.wap;
}
}
if (NCT != NetworkComponentType.firewall)
{
gateway = GetGateway();
}