git-svn-id: https://spexeah.com:8443/svn/Asuro@744 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
1 parent
a7c568b06a
commit
17f41d9794
27 files changed
+54
-49
No files matched your search
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user