diff --git a/Asuro.iso b/Asuro.iso index a1893c2a..29b179df 100644 Binary files a/Asuro.iso and b/Asuro.iso differ diff --git a/bin/kernel.bin b/bin/kernel.bin index 8e5e0d24..dc8d7ecc 100755 Binary files a/bin/kernel.bin and b/bin/kernel.bin differ diff --git a/compile.sh b/compile.sh index 683c47bc..67911d9c 100755 --- a/compile.sh +++ b/compile.sh @@ -94,3 +94,5 @@ fi echo " " echo "=======================" echo " " + +cp Asuro.iso ~/host/Asuro.iso diff --git a/iso/boot/asuro.bin b/iso/boot/asuro.bin index 8e5e0d24..dc8d7ecc 100755 Binary files a/iso/boot/asuro.bin and b/iso/boot/asuro.bin differ diff --git a/lib/E1000.ppu b/lib/E1000.ppu index 7ab8b0d6..888562c0 100644 Binary files a/lib/E1000.ppu and b/lib/E1000.ppu differ diff --git a/lib/arp.ppu b/lib/arp.ppu index 10a33c21..735c1a08 100644 Binary files a/lib/arp.ppu and b/lib/arp.ppu differ diff --git a/lib/asuro.ppu b/lib/asuro.ppu index 1db056e6..6d0c0205 100644 Binary files a/lib/asuro.ppu and b/lib/asuro.ppu differ diff --git a/lib/eth2.ppu b/lib/eth2.ppu index 7b9c8744..51088ba6 100644 Binary files a/lib/eth2.ppu and b/lib/eth2.ppu differ diff --git a/lib/ipv4.ppu b/lib/ipv4.ppu index f86826d4..e7debf7f 100644 Binary files a/lib/ipv4.ppu and b/lib/ipv4.ppu differ diff --git a/lib/libpconsole.a b/lib/libpconsole.a index a5658cbb..bc5f8294 100644 Binary files a/lib/libpconsole.a and b/lib/libpconsole.a differ diff --git a/lib/libpmultiboot.a b/lib/libpmultiboot.a index 7ecc630a..f50929f5 100644 Binary files a/lib/libpmultiboot.a and b/lib/libpmultiboot.a differ diff --git a/lib/libpsystem.a b/lib/libpsystem.a index 076e643e..5bb4b056 100644 Binary files a/lib/libpsystem.a and b/lib/libpsystem.a differ diff --git a/lib/net.ppu b/lib/net.ppu index b557c0ea..f3471507 100644 Binary files a/lib/net.ppu and b/lib/net.ppu differ diff --git a/lib/nettypes.ppu b/lib/nettypes.ppu index 2cd54d0d..48255e7f 100644 Binary files a/lib/nettypes.ppu and b/lib/nettypes.ppu differ diff --git a/lib/netutils.ppu b/lib/netutils.ppu index 4812d6ce..16a1fd35 100644 Binary files a/lib/netutils.ppu and b/lib/netutils.ppu differ diff --git a/lib/shell.ppu b/lib/shell.ppu index 638dbae2..a3888b45 100644 Binary files a/lib/shell.ppu and b/lib/shell.ppu differ diff --git a/lib/terminal.ppu b/lib/terminal.ppu index e6f8aae5..99bb49c5 100644 Binary files a/lib/terminal.ppu and b/lib/terminal.ppu differ diff --git a/src/driver/net/include/nettypes.pas b/src/driver/net/include/nettypes.pas index 9c4a070f..06d3ff56 100644 --- a/src/driver/net/include/nettypes.pas +++ b/src/driver/net/include/nettypes.pas @@ -102,8 +102,8 @@ type PIPV4Header = ^TIPV4Header; TIPV4Header = bitpacked record - version : ubit4; header_len : ubit4; + version : ubit4; ToS : uint8; total_len_Hi : uint8; total_len_Lo : uint8; diff --git a/src/driver/net/include/netutils.pas b/src/driver/net/include/netutils.pas index c3f44a87..1f27e57d 100644 --- a/src/driver/net/include/netutils.pas +++ b/src/driver/net/include/netutils.pas @@ -70,17 +70,20 @@ var begin dat:= p_data; sum:= 0; - l:= p_len div 2; - for i:=1 to l do begin - sum:= sum + p_data^; - inc(p_data); + l:= p_len; + + while l > 1 do begin + sum:= sum + dat^; + inc(dat); + l:= l - 2; end; - while (sum > $FFFF) do begin - carry:= (sum AND $FFFF0000) SHR 16; - sum:= (sum AND $FFFF); - sum:= sum + carry; + if l > 0 then sum:= sum + puint8(dat)^; + + while (sum AND $FFFF0000) > 0 do begin + sum:= (sum AND $FFFF) + (sum SHR 16); end; - calculateChecksum:= not (sum AND $FFFF); + + calculateChecksum:= not(sum); end; function verifyChecksum(p_data : puint16; p_len : uint16) : boolean; diff --git a/src/driver/net/l1/net.pas b/src/driver/net/l1/net.pas index 4e14452e..9ec69569 100644 --- a/src/driver/net/l1/net.pas +++ b/src/driver/net/l1/net.pas @@ -83,7 +83,7 @@ end; procedure send(p_data : void; p_len : uint16); begin push_trace('net.send'); - //writeToLogLn('L1: net.send'); + writeToLogLn('L1: net.send'); if CBSend <> nil then CBSend(p_data, p_len); pop_trace; end; @@ -94,7 +94,7 @@ var begin push_trace('net.recv'); - //writeToLogLn('L1: net.recv'); + writeToLogLn('L1: net.recv'); context:= newPacketContext; if CBNext <> nil then CBNext(p_data, p_len, context); freePacketContext(context); diff --git a/src/driver/net/l2/eth2.pas b/src/driver/net/l2/eth2.pas index 374bcc6d..6fb8162a 100644 --- a/src/driver/net/l2/eth2.pas +++ b/src/driver/net/l2/eth2.pas @@ -54,7 +54,7 @@ begin pad:= 46 - p_len; if pad < 0 then pad:= 0; push_trace('eth2.send'); - //writeToLogLn(' L2: eth2.send'); + writeToLogLn(' L2: eth2.send'); if p_context <> nil then begin size:= sizeof(TEthernetHeader) + p_len + pad;// + 4; buffer:= kalloc(size); @@ -79,7 +79,7 @@ var begin push_trace('eth2.recv'); - //writeToLogLn(' L2: eth2.recv'); + writeToLogLn(' L2: eth2.recv'); buf:= puint8(p_data); Header:= PEthernetHeader(buf); diff --git a/src/driver/net/l3/arp.pas b/src/driver/net/l3/arp.pas index 8cb4f7cf..6ebd4145 100644 --- a/src/driver/net/l3/arp.pas +++ b/src/driver/net/l3/arp.pas @@ -181,7 +181,7 @@ var begin push_trace('arp.recv'); - //writeToLogLn(' L3: arp.recv'); + writeToLogLn(' L3: arp.recv'); console.redrawWindows; { Get our converted Header } @@ -210,7 +210,7 @@ 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'); + 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]); @@ -220,28 +220,28 @@ begin freePacketContext(context); end; $2:begin { ARP Reply } - //writeToLogLn(' arp.recv.arp.rep'); + writeToLogLn(' arp.recv.arp.rep'); end; $3:begin { RARP Request } - //writeToLogLn(' arp.recv.rarp.req'); + writeToLogLn(' arp.recv.rarp.req'); end; $4:begin { RARP Reply } - //writeToLogLn(' arp.recv.rarp.rep'); + writeToLogLn(' arp.recv.rarp.rep'); end; $5:begin { DRARP Request } - //writeToLogLn(' arp.recv.drarp.req'); + writeToLogLn(' arp.recv.drarp.req'); end; $6:begin { DRARP Reply } - //writeToLogLn(' arp.recv.drarp.rep'); + writeToLogLn(' arp.recv.drarp.rep'); end; $7:begin { DRARP Error } - //writeToLogLn(' arp.recv.drarp.err'); + writeToLogLn(' arp.recv.drarp.err'); end; $8:begin { InARP Request } - //writeToLogLn(' arp.recv.inarp.req'); + writeToLogLn(' arp.recv.inarp.req'); end; $9:begin { InARP Reply } - //writeToLogLn(' arp.recv.inarp.rep'); + writeToLogLn(' arp.recv.inarp.rep'); end; end; end; diff --git a/src/driver/net/l3/ipv4.pas b/src/driver/net/l3/ipv4.pas index 75bfa568..7ec0ce07 100644 --- a/src/driver/net/l3/ipv4.pas +++ b/src/driver/net/l3/ipv4.pas @@ -39,7 +39,7 @@ var buffer : void; begin - //writeToLogLn(' L3: ipv4.send'); + writeToLogLn(' L3: ipv4.send'); inc(CurrentID); Header.version:= 4; Header.header_len:= 5; @@ -60,8 +60,8 @@ begin Header.Options:= 0; Header.Padding:= 0; CHK:= calculateChecksum(puint16(@Header), sizeof(TIPV4Header)); - Header.HDR_CHK_Hi:= CHK SHR 8; - Header.HDR_CHK_Lo:= CHK AND $FF; + Header.HDR_CHK_Hi:= CHK AND $FF;//CHK SHR 8; + Header.HDR_CHK_Lo:= CHK SHR 8;//CHK AND $FF; Buffer:= kalloc(Len); memcpy(uint32(@Header), uint32(Buffer), Header.header_len * 4); memcpy(uint32(p_data), uint32(Buffer) + (Header.header_len * 4), p_len); @@ -79,7 +79,7 @@ var begin push_trace('ipv4.recv'); - //writeToLogLn(' L3: ipv4.recv'); + writeToLogLn(' L3: ipv4.recv'); Header:= PIPV4Header(p_data); AHeader.version:= Header^.version; AHeader.header_len:= Header^.header_len; @@ -108,7 +108,9 @@ begin if Config.UP then begin if (IPEqual(@Config.Address[0], @AHeader.Dst[0])) OR (AHeader.Dst[3] = 255) then begin - if Protocols[AHeader.Protocol] <> nil then Protocols[AHeader.Protocol](void(buf), len, p_context); + if Protocols[AHeader.Protocol] <> nil then begin + Protocols[AHeader.Protocol](void(buf), len, p_context); + end; end; end; pop_trace; diff --git a/src/driver/net/l4/icmp.pas b/src/driver/net/l4/icmp.pas index 12f29042..ba537958 100644 --- a/src/driver/net/l4/icmp.pas +++ b/src/driver/net/l4/icmp.pas @@ -3,7 +3,7 @@ unit icmp; interface uses - net, nettypes, netutils, ipv4, console; + net, nettypes, netutils, ipv4, console, terminal; procedure register; @@ -25,23 +25,26 @@ var CHK : uint16; begin - writeToLogLn(' L4: icmp.recv'); + 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; Header^.ICMP_CHK_Hi:= 0; Header^.ICMP_CHK_Lo:= 0; - CHK:= calculateChecksum(puint16(p_data), sizeof(TICMPHeader)); - Header^.ICMP_CHK_Hi:= CHK SHR 8; - Header^.ICMP_CHK_Lo:= CHK AND $FF; + CHK:= calculateChecksum(puint16(p_data), p_len); + Header^.ICMP_CHK_Hi:= CHK AND $FF; + Header^.ICMP_CHK_Lo:= CHK SHR 8; p_context^.Protocol.L4:= $01; + p_context^.TTL:= 128; ipv4.send(p_data, p_len, p_context); end; $00:begin //Reply - + writeToLogLn(' L4: icmp.reply'); end; end; end; diff --git a/src/driver/netdev/E1000.pas b/src/driver/netdev/E1000.pas index 6356bbc9..5a7e5d69 100644 --- a/src/driver/netdev/E1000.pas +++ b/src/driver/netdev/E1000.pas @@ -417,7 +417,7 @@ var begin push_trace('E1000.fire'); - //writeToLogLn('L0: E1000 Fire'); + writeToLogLn('L0: E1000 Fire'); status:= readCommand($C0); if (status AND $04) > 0 then begin startLink(); diff --git a/src/include/asuro.pas b/src/include/asuro.pas index cc89183d..e7707962 100644 --- a/src/include/asuro.pas +++ b/src/include/asuro.pas @@ -9,14 +9,14 @@ const VERSION_SUB = '1'; REVISION = '728'; RELEASE = 'ia'; - LINE_COUNT = 28519; + LINE_COUNT = 28522; FILE_COUNT = 90; DRIVER_COUNT = 32; FPC_VERSION = '2.6.4'; NASM_VERSION = '2.10.09'; MAKE_VERSION = '3.81'; COMPILE_DATE = '13/05/18'; - COMPILE_TIME = '15:24:12'; + COMPILE_TIME = '16:34:39'; implementation diff --git a/src/prog/terminal.pas b/src/prog/terminal.pas index d0194151..9425c8ed 100644 --- a/src/prog/terminal.pas +++ b/src/prog/terminal.pas @@ -509,19 +509,14 @@ end; procedure teapot(Params : PParamList); var - ip1, ip2, ip3 : pchar; + packet : array[0..39] of uint8 = ( $00, $00, $00, $00, $00, $01, $00, $f3, $61, $62, $63, $64, $65, $66, $67, $68, + $69, $6a, $6b, $6c, $6d, $6e, $6f, $70, $71, $72, $73, $74, $75, $76, $77, $61, + $62, $63, $64, $65, $66, $67, $68, $69); + CHK : uint16; begin - if paramCount(Params) > 2 then begin - ip1:= getParam(0, Params); - ip2:= getParam(1, Params); - ip3:= getParam(2, Params); - if sameSubnetIPv4(stringToIPv4(ip1), stringToIPv4(ip2), stringToIPv4(ip3)) then begin - console.writeStringlnWND('Same.', getTerminalHWND); - end else begin - console.writeStringlnWND('Different', getTerminalHWND); - end; - end; + CHK:= calculateChecksum(puint16(@packet[0]), 40); + writehexlnWND(CHK, getTerminalHWND); terminal.halt(555, @teapot_halt); end;