Fix bootp migration
This commit is contained in:
parent
0823cc25d3
commit
8ab872589c
2 changed files with 7 additions and 7 deletions
|
@ -5,6 +5,7 @@ using System.Net;
|
|||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using IPMeow.Lib;
|
||||
using IPMeow.Lib.Address;
|
||||
|
||||
namespace IPMeow.Dhcp.Server.Dhcp4;
|
||||
|
||||
|
@ -31,7 +32,7 @@ public class BootpHeader
|
|||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{Hops}\nXid: {Xid}, Seconds: {Seconds}, Flags: {Flags:x}\nci: {ClientAddress}\nyi: {YourAddress}, ns: {NextServerAddress}, ra: {RelayAgentAddress}\nhw: {MacAddress.Parse(GetMacAddress())}\nhost: {ServerHostName}\nboot: {BootFileName}";
|
||||
return $"{Hops}\nXid: {Xid}, Seconds: {Seconds}, Flags: {Flags:x}\nci: {ClientAddress}\nyi: {YourAddress}, ns: {NextServerAddress}, ra: {RelayAgentAddress}\nhw: {MacAddress.Parse(GetMacAddress())}";
|
||||
}
|
||||
|
||||
public byte[] GetClientHwAddress()
|
||||
|
@ -110,7 +111,7 @@ public class BootpHeader
|
|||
using MemoryStream buffer = new();
|
||||
BinaryWriter writer = new(buffer);
|
||||
|
||||
writer.Write((byte));
|
||||
writer.Write((byte)OpType);
|
||||
writer.Write((byte)1);
|
||||
writer.Write((byte)6);
|
||||
writer.Write(Hops);
|
||||
|
@ -122,8 +123,7 @@ public class BootpHeader
|
|||
writer.Write(NextServerAddress.GetAddressBytes());
|
||||
writer.Write(RelayAgentAddress.GetAddressBytes());
|
||||
writer.Write(GetClientHwAddress());
|
||||
writer.Write(GetSnameBytes());
|
||||
writer.Write(GetBootFileBytes());
|
||||
writer.Write(Enumerable.Repeat((byte)0, 64 + 128).ToArray());
|
||||
|
||||
return buffer.GetBuffer();
|
||||
}
|
||||
|
|
|
@ -49,8 +49,8 @@ public class Dhcp4Server : IDhcpServer, IDisposable
|
|||
DhcpRequestedEvent.Invoke(this, new()
|
||||
{
|
||||
IsV6 = false,
|
||||
MacAddress = MacAddress.Parse(packet.GetMacAddress()),
|
||||
RequestOrigin = packet.ClientAddress
|
||||
MacAddress = MacAddress.Parse(packet.Header.GetMacAddress()),
|
||||
RequestOrigin = packet.Header.ClientAddress
|
||||
});
|
||||
//TODO
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ public class Dhcp4Server : IDhcpServer, IDisposable
|
|||
return false;
|
||||
}
|
||||
|
||||
if (packet.NextServerAddress != IPAddress.Any)
|
||||
if (packet.Header.NextServerAddress != IPAddress.Any)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue