Fixed and improved Ping support
authorJohn Hodge <tpg@prelude.(none)>
Wed, 3 Feb 2010 03:57:48 +0000 (11:57 +0800)
committerJohn Hodge <tpg@prelude.(none)>
Wed, 3 Feb 2010 03:57:48 +0000 (11:57 +0800)
- BUG: ARP requests time out for some reason, todo check on other networks
- Also updated the readme for better support when building

Kernel/Makefile.BuildNum
Makefile
Modules/IPStack/icmp.c
README

index 62bf932..be8bd60 100644 (file)
@@ -1 +1 @@
-BUILD_NUM = 1422
+BUILD_NUM = 1423
index 56878c1..ae98e80 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -11,7 +11,7 @@
 SUBMAKE = $(MAKE) --no-print-directory
 
 MODULES += $(DYNMODS)
-USRLIBS = ld-acess.so libacess.so libgcc.so libc.so
+USRLIBS = crt0.o ld-acess.so libacess.so libgcc.so libc.so
 USRAPPS = init login CLIShell cat ls mount ifconfig
 
 ALL_MODULES = $(addprefix all-,$(MODULES))
index 90ef7cb..34e6eda 100644 (file)
@@ -52,7 +52,7 @@ void ICMP_GetPacket(tInterface *Interface, void *Address, int Length, void *Buff
                        Warning("[ICMP ] Code == %i for ICMP Echo Reply, should be 0", hdr->Code);
                        return ;
                }
-               if(hdr->ID != ~hdr->Sequence) {
+               if(hdr->ID != (Uint16)~hdr->Sequence) {
                        Warning("[ICMP ] ID and Sequence values do not match");
                        return ;
                }
@@ -82,7 +82,8 @@ void ICMP_GetPacket(tInterface *Interface, void *Address, int Length, void *Buff
  */
 int ICMP_Ping(tInterface *Interface, tIPv4 Addr)
 {
-       //Sint64        ts;
+       Sint64  ts;
+       Sint64  end;
        char    buf[32] = "\x8\0\0\0\0\0\0\0Acess2 I"
                       "P/TCP Stack 1.0\0";
        tICMPHeader     *hdr = (void*)buf;
@@ -104,5 +105,13 @@ int ICMP_Ping(tInterface *Interface, tIPv4 Addr)
        hdr->Checksum = htons( IPv4_Checksum(hdr, sizeof(buf)) );
        IPv4_SendPacket(Interface, Addr, 1, i, sizeof(buf), buf);
        
-       return -1;
+       ts = now();
+       end = ts + Interface->TimeoutDelay;
+       while( !gICMP_PingSlots[i].bArrived && now() < end)     Threads_Yield();
+       
+       ts = now() - ts;
+       if(ts > Interface->TimeoutDelay)
+               return -1;
+       
+       return (int)ts;
 }
diff --git a/README b/README
index 4fb8be1..5680779 100644 (file)
--- a/README
+++ b/README
@@ -29,6 +29,7 @@ The /Kernel tree contains the kernel sources.
  /Usermode/include - Required include files for the shared libraries.
 
 === Building ===
+Required Tools: GNU Toolchain (GCC,Gas,binutils), NASM, mtools, GNU calc
 Compiling Acess is relatively simple (at the moment)
 First edit /Makefile.cfg and set the build programs (making sure they match
   the architecture you are building for).

UCC git Repository :: git.ucc.asn.au