DHCP Works now.

git-svn-id: https://spexeah.com:8443/svn/Asuro@1034 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
kieron
2020-07-12 17:02:14 +00:00
parent 46cb414b43
commit fbc59a1617
12 changed files with 389 additions and 166 deletions
+5 -5
View File
@@ -36,7 +36,7 @@ uses
var
CBSend : TNetSendCallback = nil;
CBNext : TRecvCallback = nil;
MAC : puint8 = @NULL_MAC[0];
MAC : puint8 = @NULL_MAC[0];
procedure writeToLog(str : pchar);
var
@@ -92,8 +92,8 @@ end;
procedure send(p_data : void; p_len : uint16);
begin
push_trace('net.send');
writeToLogLn('L1: net.send');
//push_trace('net.send');
//writeToLogLn('L1: net.send');
if CBSend <> nil then CBSend(p_data, p_len);
pop_trace;
end;
@@ -103,8 +103,8 @@ var
context : PPacketContext;
begin
push_trace('net.recv');
writeToLogLn('L1: net.recv');
//push_trace('net.recv');
//writeToLogLn('L1: net.recv');
context:= newPacketContext;
if CBNext <> nil then CBNext(p_data, p_len, context);
freePacketContext(context);
+1 -5
View File
@@ -34,7 +34,6 @@ var
procedure registerTypePromisc(eType : uint16; RecvCB : TRecvCallback);
begin
push_trace('eth2.registerType');
register;
if EthTypes[eType] = nil then EthTypes[eType]:= RecvCB;
Promisc[eType]:= true;
@@ -42,7 +41,6 @@ end;
procedure registerType(eType : uint16; RecvCB : TRecvCallback);
begin
push_trace('eth2.registerType');
register;
if EthTypes[eType] = nil then EthTypes[eType]:= RecvCB;
end;
@@ -83,8 +81,7 @@ var
buf : puint8;
begin
push_trace('eth2.recv');
writeToLogLn(' L2: eth2.recv');
//writeToLogLn(' L2: eth2.recv');
buf:= puint8(p_data);
Header:= PEthernetHeader(buf);
@@ -102,7 +99,6 @@ begin
EthTypes[proto_type](void(buf), p_len - 14, p_context);
end;
end;
pop_trace;
end;
procedure register;
+8 -15
View File
@@ -80,8 +80,6 @@ var
hSize, pSize : uint8;
begin
push_trace('arp.send');
writeToLogLn(' L3: arp.send');
if p_context <> nil then begin
buf:= kalloc(sizeof(TARPHeader));
hdr:= PARPHeader(buf);
@@ -189,10 +187,6 @@ var
context : PPacketContext;
begin
push_trace('arp.recv');
writeToLogLn(' L3: arp.recv');
console.redrawWindows;
{ Get our converted Header }
Header:= PARPHeader(p_data);
AHeader.Hardware_Type:= (Header^.Hardware_Type_Hi SHL 8) + Header^.Hardware_Type_Lo;
@@ -219,7 +213,6 @@ begin
if IPEqual(@AHeader.Destination_Protocol[0], @getIPv4Config^.Address[0]) then begin
case AHeader.Operation of
$1:begin { ARP Request }
writeToLogLn(' arp.recv.arp.req');
context:= newPacketContext;
copyMAC(@AHeader.Source_Hardware[0], @context^.MAC.Destination[0]);
copyIPv4(@AHeader.Source_Protocol[0], @context^.IP.Destination[0]);
@@ -229,28 +222,28 @@ begin
freePacketContext(context);
end;
$2:begin { ARP Reply }
writeToLogLn(' arp.recv.arp.rep');
end;
$3:begin { RARP Request }
writeToLogLn(' arp.recv.rarp.req');
end;
$4:begin { RARP Reply }
writeToLogLn(' arp.recv.rarp.rep');
end;
$5:begin { DRARP Request }
writeToLogLn(' arp.recv.drarp.req');
end;
$6:begin { DRARP Reply }
writeToLogLn(' arp.recv.drarp.rep');
end;
$7:begin { DRARP Error }
writeToLogLn(' arp.recv.drarp.err');
end;
$8:begin { InARP Request }
writeToLogLn(' arp.recv.inarp.req');
end;
$9:begin { InARP Reply }
writeToLogLn(' arp.recv.inarp.rep');
end;
end;
end;
+1 -7
View File
@@ -44,7 +44,6 @@ var
buffer : void;
begin
writeToLogLn(' L3: ipv4.send');
inc(CurrentID);
Header.version:= 4;
Header.header_len:= 5;
@@ -83,8 +82,6 @@ var
len : uint16;
begin
push_trace('ipv4.recv');
writeToLogLn(' L3: ipv4.recv');
Header:= PIPV4Header(p_data);
AHeader.version:= Header^.version;
AHeader.header_len:= Header^.header_len;
@@ -112,7 +109,7 @@ begin
copyIPv4(@AHeader.Dst[0], @p_context^.IP.Destination[0]);
if Config.UP then begin
if (IPEqual(@Config.Address[0], @AHeader.Dst[0])) OR (AHeader.Dst[3] = 255) then begin
if (IPEqual(@Config.Address[0], @AHeader.Dst[0])) OR (AHeader.Dst[3] = 255) OR (IPEqual(@Config.Address[0], @NULL_IP[0])) then begin
if Protocols[AHeader.Protocol] <> nil then begin
Protocols[AHeader.Protocol](void(buf), len, p_context);
end;
@@ -130,7 +127,6 @@ var
i : uint32;
begin
push_trace('ipv4.terminal_command_ifconfig');
if paramCount(params) > 1 then begin
Command:= GetParam(0, Params);
if StringEquals(Command, 'set') then begin
@@ -177,7 +173,6 @@ begin
else
writestringlnWND(' NetUP: false', getTerminalHWND);
end;
pop_trace;
end;
procedure register;
@@ -205,7 +200,6 @@ end;
procedure registerProtocol(Protocol_ID : uint8; recv_callback : TRecvCallback);
begin
push_trace('ipv4.registerProtocol');
register;
if Protocols[Protocol_ID] = nil then Protocols[Protocol_ID]:= recv_callback;
pop_trace;
-3
View File
@@ -118,12 +118,10 @@ var
Handle : uint8;
begin
writeToLogLn(' L4: icmp.recv');
Header:= PICMPHeader(p_data);
//writehexlnWND(Header^.ICMP_Type, getTerminalHWND);
case Header^.ICMP_Type of
$08:Begin //Request
writeToLogLn(' L4: icmp.request');
contextMACSwitch(p_context);
contextIPv4Switch(p_context);
Header^.ICMP_Type:= 0;
@@ -137,7 +135,6 @@ begin
ipv4.send(p_data, p_len, p_context);
end;
$00:begin //Reply
writeToLogLn(' L4: icmp.reply');
Handle:= Header^.Identifier;
if (Handle > 0) and (Handle < 256) then begin
If Handlers[Handle].Active then begin
-15
View File
@@ -123,20 +123,6 @@ begin
memcpy(uint32(hdr), uint32(buffer), sizeof(TUDPHeader));
memcpy(uint32(p_data), uint32(buffer) + sizeof(TUDPHeader), p_len);
writehexln(uint32(buffer) + sizeof(TUDPHeader));
for i:=0 to p_len-1 do begin
writehexpair(puint8(p_data)[i]);
end;
writestringln(' ');
for i:=0 to p_len-1 do begin
writechar(pchar(p_data)[i]);
end;
writestringln(' ');
for i:=0 to size-1 do begin
writehexpair(puint8(buffer)[i]);
end;
writestringln(' ');
udpContext^.context^.Protocol.L4:= $11;
ipv4.send(buffer, size, udpContext^.context);
@@ -203,7 +189,6 @@ var
size : uint16;
begin
writeToLogLn(' L4: udp.recv');
header:= PUDPHeader(p_data);
if Ports[switchendian16(header^.DstPort)] <> nil then begin
context:= PUDPPacketContext(kalloc(sizeof(TUDPPacketContext)));
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -20,7 +20,7 @@ end;
function rand32 : uint32;
begin
rand32:= (rand SHL 16) AND rand;
rand32:= (rand SHL 16) OR rand;
end;
function rand16 : uint16;
@@ -35,7 +35,7 @@ end;
procedure srand(seed : uint32);
begin
next:= seed;
next:= next + seed;
end;
end.
+7 -32
View File
@@ -19,8 +19,8 @@ uses
tracer,
drivermanagement,
scheduler,
progmanager,
PCI,
Terminal,
strings,
USB,
testdriver,
@@ -35,22 +35,12 @@ uses
fonts,
RTC,
serial,
shell,
memview,
splash,
themer,
netlog,
vmlog,
vm,
vmstate,
edit,
udpcat,
cpu,
md5,
md5sum,
base64,
base64_prog,
rand;
rand,
terminal;
procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: uint32); stdcall;
@@ -159,7 +149,7 @@ begin
isrmanager.init();
faults.init();
RTC.init();
rand.srand((getDateTime.Seconds SHR 24) OR (getDateTime.Minutes SHR 16) OR (getDateTime.Hours SHR 8) OR (getDateTime.Day));
pmemorymanager.init();
vmemorymanager.init();
lmemorymanager.init();
@@ -214,24 +204,7 @@ begin
//vm.init();
{ Init Progs }
tracer.push_trace('kmain.SHELLINIT');
shell.init();
tracer.push_trace('kmain.MEMVIEWINIT');
memview.init();
tracer.push_trace('kmain.THEMERINIT');
themer.init();
tracer.push_trace('kmain.NETLOGINIT');
netlog.init();
tracer.push_trace('kmain.VMLOGINIT');
vmlog.init();
tracer.push_trace('kmain.VMSTATEINIT');
vmstate.init();
tracer.push_trace('kmain.EDIT');
edit.init();
udpcat.init();
md5sum.init();
base64_prog.init();
terminal.run();
progmanager.init();
{ Init Splash }
//tracer.push_trace('kmain.SPLASHINIT');
@@ -244,8 +217,10 @@ begin
console.setdefaultattribute(console.combinecolors($17E0, $0000));
console.writestringln('Asuro Booted Correctly!');
console.setdefaultattribute(console.combinecolors($FFFF, $0000));
writestringln(' ');
tracer.push_trace('kmain.END');
rand.srand((getDateTime.Seconds SHR 24) OR (getDateTime.Minutes SHR 16) OR (getDateTime.Hours SHR 8) OR (getDateTime.Day));
tracer.push_trace('kmain.TICK');
while true do begin
+1 -1
View File
@@ -1,5 +1,5 @@
{
Prog->VMLog - Virtual Machine Event Log.
Prog->MD5Sum - MD5 Checksum of a given string.
@author(Kieron Morris <[email protected]>)
}
+11
View File
@@ -20,6 +20,14 @@ implementation
uses
console, lmemorymanager, util, strings, serial, terminal;
type
PTracerEntry = ^TTracerEntry;
TTracerEntry = record
Next : PTracerEntry;
Data : pchar;
Previous : PTracerEntry;
end;
const
MAX_TRACE = 40;
@@ -29,6 +37,9 @@ var
Traces : Array[0..MAX_TRACE-1] of PChar;
c_lock : Boolean = false;
var
head : PTracerEntry;
tail : PTracerEntry;
procedure terminal_command_tracer(Params : PParamList);
var