+
+ // -- 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) {
+ Warning("[ICMP ] Code == %i for ICMP Echo Request, should be 0", hdr->Code);
+ return ;
+ }
+ Log("[ICMP ] Replying");
+ hdr->Type = ICMP_ECHOREPLY;
+ hdr->Checksum = 0;
+ hdr->Checksum = htons( IPv4_Checksum(hdr, Length) );
+ Log("[ICMP ] Checksum = 0x%04x", hdr->Checksum);
+ IPv4_SendPacket(Interface, *(tIPv4*)Address, 1, ntohs(hdr->Sequence), Length, hdr);
+ break;
+ default:
+ break;