Get DHCP server on wRouter to work.
This commit is contained in:
parent
4b0b06fb65
commit
8b54d92b1e
@ -199,6 +199,14 @@ namespace EduNetworkBuilder
|
||||
CanAddNics = false;
|
||||
setNicsCanUseDHCP(true);
|
||||
}
|
||||
if (myType == NetworkComponentType.wrouter)
|
||||
{
|
||||
CanServeDHCP = true;
|
||||
CanUseDHCP = true;
|
||||
MustUseDHCP = false;
|
||||
CanAddNics = false;
|
||||
setNicsCanUseDHCP(true);
|
||||
}
|
||||
}
|
||||
|
||||
private void setNicsCanUseDHCP(bool CanUse)
|
||||
@ -1014,6 +1022,7 @@ namespace EduNetworkBuilder
|
||||
public ResponseToPacket HowToRespondToPacket(Packet tPacket)
|
||||
{
|
||||
bool typesMatch=false;
|
||||
if (tPacket.sourceIP == null) return ResponseToPacket.reject;
|
||||
foreach(IPConnectionEntry ipc in IPConnections)
|
||||
{
|
||||
if(ipc.destIP.GetIP == tPacket.sourceIP.GetIP || HasBroadcastAddress(ipc.destIP))
|
||||
@ -1472,7 +1481,13 @@ namespace EduNetworkBuilder
|
||||
nPacket.MyStatus = PacketStatus.processing;
|
||||
|
||||
tPacket.AddMessage(DebugLevel.info, "Success! The DHCP request reached a DHCP Server.");
|
||||
tPacket.Tracking.Status = hostname + ":\tDHCP Request found Server: " + nPacket.sourceIP.GetIPString;
|
||||
string IP = "";
|
||||
if (nPacket.sourceIP != null) IP = nPacket.sourceIP.GetIPString;
|
||||
if(IP == "" && nPacket.WhereAmI != null) {
|
||||
IPAddress tIP = HubManagementIP();
|
||||
if (tIP != null) IP = tIP.GetIPString;
|
||||
}
|
||||
tPacket.Tracking.Status = hostname + ":\tDHCP Request found Server: " + IP;
|
||||
tPacket.MyStatus = PacketStatus.finished_ok;
|
||||
return;
|
||||
}
|
||||
@ -1499,7 +1514,10 @@ namespace EduNetworkBuilder
|
||||
else
|
||||
{
|
||||
tPacket.AddMessage(DebugLevel.info, "ERROR! A packet returned to a machine that we were not expecting it from.");
|
||||
tPacket.Tracking.Status = hostname + ":\tDHCP Request failed: Arrived at a machine that was not expecting it and was rejected." + tPacket.sourceIP.GetIP.ToIpString() + " -> " + tPacket.destIP.GetIP.ToIpString();
|
||||
string sIP = "?.?.?.?";
|
||||
if (tPacket.sourceIP != null)
|
||||
sIP = tPacket.sourceIP.GetIP.ToIpString();
|
||||
tPacket.Tracking.Status = hostname + ":\tDHCP Request failed: Arrived at a machine that was not expecting it and was rejected." + sIP + " -> " + tPacket.destIP.GetIP.ToIpString();
|
||||
tPacket.MyStatus = PacketStatus.finished_failed;
|
||||
}
|
||||
return;
|
||||
@ -2184,6 +2202,7 @@ namespace EduNetworkBuilder
|
||||
|
||||
public IPAddress DHCPRangeMatchingInterface(IPAddress InterfaceIP)
|
||||
{
|
||||
if (InterfaceIP == null) return null;
|
||||
foreach (IPAddress ip in DHCPRanges)
|
||||
{
|
||||
if (ip.GetIP.ToIpString() != "127.0.0.1" && InterfaceIP.IsLocal(ip))
|
||||
@ -2254,6 +2273,8 @@ namespace EduNetworkBuilder
|
||||
/// <returns>an IPAddress IP/Mask/GW</returns>
|
||||
public IPAddress RequestDHCPLease(string MAC, IPAddress NIC_IP)
|
||||
{
|
||||
if (NIC_IP == null)
|
||||
NIC_IP = HubManagementIP();
|
||||
IPAddress tAddress = LookupDHCPLease(MAC, NIC_IP);
|
||||
if (tAddress != null) return tAddress;
|
||||
|
||||
|
@ -316,6 +316,7 @@ namespace EduNetworkBuilder
|
||||
|
||||
public void StartOnLink(NetworkLink theLink, NetworkDevice start_device)
|
||||
{
|
||||
if (theLink == null) return;
|
||||
WhereAmI = theLink;
|
||||
MyStatus = PacketStatus.moving;
|
||||
myLinkPercent = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user