svn commit: branches/busybox_1_00_stable/busybox/networking

vapier at busybox.net vapier at busybox.net
Thu Sep 15 01:34:28 UTC 2005


Author: vapier
Date: 2005-09-14 18:34:28 -0700 (Wed, 14 Sep 2005)
New Revision: 11467

Log:
merge endian fix from trunk

Modified:
   branches/busybox_1_00_stable/busybox/networking/ping.c


Changeset:
Modified: branches/busybox_1_00_stable/busybox/networking/ping.c
===================================================================
--- branches/busybox_1_00_stable/busybox/networking/ping.c	2005-09-15 01:32:48 UTC (rev 11466)
+++ branches/busybox_1_00_stable/busybox/networking/ping.c	2005-09-15 01:34:28 UTC (rev 11467)
@@ -223,9 +223,9 @@
 	pkt->icmp_type = ICMP_ECHO;
 	pkt->icmp_code = 0;
 	pkt->icmp_cksum = 0;
-	pkt->icmp_seq = ntransmitted++;
+	pkt->icmp_seq = htons(ntransmitted++);
 	pkt->icmp_id = myid;
-	CLR(pkt->icmp_seq % MAX_DUP_CHK);
+	CLR(ntohs(pkt->icmp_seq) % MAX_DUP_CHK);
 
 	gettimeofday((struct timeval *) &packet[8], NULL);
 	pkt->icmp_cksum = in_cksum((unsigned short *) pkt, sizeof(packet));
@@ -293,6 +293,7 @@
 	    return;				/* not our ping */
 
 	if (icmppkt->icmp_type == ICMP_ECHOREPLY) {
+		u_int16_t recv_seq = ntohs(icmppkt->icmp_seq);
 	    ++nreceived;
 		tp = (struct timeval *) icmppkt->icmp_data;
 
@@ -309,12 +310,12 @@
 		if (triptime > tmax)
 			tmax = triptime;
 
-		if (TST(icmppkt->icmp_seq % MAX_DUP_CHK)) {
+		if (TST(recv_seq % MAX_DUP_CHK)) {
 			++nrepeats;
 			--nreceived;
 			dupflag = 1;
 		} else {
-			SET(icmppkt->icmp_seq % MAX_DUP_CHK);
+			SET(recv_seq % MAX_DUP_CHK);
 			dupflag = 0;
 		}
 
@@ -323,7 +324,7 @@
 
 		printf("%d bytes from %s: icmp_seq=%u", sz,
 			   inet_ntoa(*(struct in_addr *) &from->sin_addr.s_addr),
-			   icmppkt->icmp_seq);
+			   recv_seq);
 		printf(" ttl=%d", iphdr->ttl);
 		printf(" time=%lu.%lu ms", triptime / 10, triptime % 10);
 		if (dupflag)




More information about the busybox-cvs mailing list