DHCP Works now.

git-svn-id: https://spexeah.com:8443/svn/Asuro@1034 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
kieron committed 2020-07-12 17:02:14 +00:00
1 parent 46cb414b43
commit fbc59a1617
12 files changed
+388 -165

No files matched your search

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