diff --git a/ping.c b/ping.c index 796ba8c..795775a 100644 --- a/ping.c +++ b/ping.c @@ -355,7 +355,7 @@ int bindDevice( int sock, const char* device ) // 0 = failed, 1 = this is a ICMP Response int isICMPResponse( int family, unsigned char* buf, int bytes ) { - assert( family == AF_INET || family == AF_INET6); + if( family != AF_INET && family != AF_INET6 ) return 0; if( bytes < 1 ) return 0; @@ -430,7 +430,7 @@ void listener( struct PreparedPing* pp ) keep_retry_quick: bytes = recvfrom( listenSock, (void*) buf, sizeof(buf), 0, (struct sockaddr*)&recvFromAddr, &recvFromAddrLen ); - if( !isICMPResponse( pp->psaddr.sin6_family, buf, bytes) ) continue; + if( !isICMPResponse( recvFromAddr.sin6_family, buf, bytes) ) continue; // compare the sender if( using_regular_ping && memcmp(&recvFromAddr, &pp->psaddr, min(recvFromAddrLen, pp->psaddr_len) ) != 0 ) continue; diff --git a/searchnet.c b/searchnet.c index f87c7e7..5d25a3b 100644 --- a/searchnet.c +++ b/searchnet.c @@ -79,6 +79,9 @@ int main( int argc, char ** argv ) mask = 1<<(32-atoi(argv[2])); speed = atof(argv[3]); + struct PingData localPingData; + PingData = &localPingData; + base &= ~(mask-1); printf( "Base: %08x / Mask: %08x\n", base, mask ); for( offset = 0; offset < mask; offset++ )