svn commit: trunk/busybox/networking

vda at busybox.net vda at busybox.net
Wed Jan 3 22:14:18 UTC 2007


Author: vda
Date: 2007-01-03 14:14:18 -0800 (Wed, 03 Jan 2007)
New Revision: 17148

Log:
ping[6]: don't do htons(a++), it can be a macro


Modified:
   trunk/busybox/networking/ping.c
   trunk/busybox/networking/ping6.c


Changeset:
Modified: trunk/busybox/networking/ping.c
===================================================================
--- trunk/busybox/networking/ping.c	2007-01-03 22:09:26 UTC (rev 17147)
+++ trunk/busybox/networking/ping.c	2007-01-03 22:14:18 UTC (rev 17148)
@@ -218,9 +218,10 @@
 	pkt->icmp_type = ICMP_ECHO;
 	pkt->icmp_code = 0;
 	pkt->icmp_cksum = 0;
-	pkt->icmp_seq = htons(ntransmitted++);
+	pkt->icmp_seq = htons(ntransmitted); /* don't ++ here, it can be a macro */
 	pkt->icmp_id = myid;
 	CLR(ntohs(pkt->icmp_seq) % MAX_DUP_CHK);
+	ntransmitted++;
 
 	gettimeofday((struct timeval *) &pkt->icmp_dun, NULL);
 	pkt->icmp_cksum = in_cksum((unsigned short *) pkt, sizeof(packet));

Modified: trunk/busybox/networking/ping6.c
===================================================================
--- trunk/busybox/networking/ping6.c	2007-01-03 22:09:26 UTC (rev 17147)
+++ trunk/busybox/networking/ping6.c	2007-01-03 22:14:18 UTC (rev 17148)
@@ -206,9 +206,10 @@
 	pkt->icmp6_type = ICMP6_ECHO_REQUEST;
 	pkt->icmp6_code = 0;
 	pkt->icmp6_cksum = 0;
-	pkt->icmp6_seq = htons(ntransmitted++);
+	pkt->icmp6_seq = htons(ntransmitted); /* don't ++ here, it can be a macro */
 	pkt->icmp6_id = myid;
 	CLR(pkt->icmp6_seq % MAX_DUP_CHK);
+	ntransmitted++;
 
 	gettimeofday((struct timeval *) &pkt->icmp6_data8[4], NULL);
 




More information about the busybox-cvs mailing list