X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Modules%2FIPStack%2Ficmp.c;h=088caaaf6e9e255206ddfe68ec102ddc45e88b7a;hb=6a945643557084578509e149c84cf5dde3c59c3c;hp=34e6eda4f5f145df7523d1e5a23a7dcedd936f80;hpb=0df427777a3ab005eaeebc1ee4a326c8dfe91b29;p=tpg%2Facess2.git diff --git a/Modules/IPStack/icmp.c b/Modules/IPStack/icmp.c index 34e6eda4..088caaaf 100644 --- a/Modules/IPStack/icmp.c +++ b/Modules/IPStack/icmp.c @@ -54,11 +54,25 @@ void ICMP_GetPacket(tInterface *Interface, void *Address, int Length, void *Buff } if(hdr->ID != (Uint16)~hdr->Sequence) { Warning("[ICMP ] ID and Sequence values do not match"); - return ; + //return ; } gICMP_PingSlots[hdr->ID].bArrived = 1; break; + // -- 3: Destination Unreachable + case ICMP_UNREACHABLE: + switch(hdr->Code) + { + case 3: // Port Unreachable + Log("[ICMP ] Destination Unreachable (Port Unreachable)"); + break; + default: + Log("[ICMP ] Destination Unreachable (Code %i)", hdr->Code); + break; + } +// IPv4_Unreachable( Interface, hdr->Code, htons(hdr->Length)-sizeof(tICMPHeader), hdr->Data ); + break; + // -- 8: Echo Request case ICMP_ECHOREQ: if(hdr->Code != 0) { @@ -72,6 +86,8 @@ void ICMP_GetPacket(tInterface *Interface, void *Address, int Length, void *Buff Log("[ICMP ] Checksum = 0x%04x", hdr->Checksum); IPv4_SendPacket(Interface, *(tIPv4*)Address, 1, ntohs(hdr->Sequence), Length, hdr); break; + default: + break; } } @@ -95,7 +111,7 @@ int ICMP_Ping(tInterface *Interface, tIPv4 Addr) { if(gICMP_PingSlots[i].Interface == NULL) break; } - if(gICMP_PingSlots[i].Interface == NULL) break; + if( i < PING_SLOTS ) break; Threads_Yield(); } gICMP_PingSlots[i].Interface = Interface;