svn commit: r225404 - in stable/7/tools/tools/netrate: netblast
netsend
Marius Strobl
marius at FreeBSD.org
Mon Sep 5 17:45:24 UTC 2011
Author: marius
Date: Mon Sep 5 17:45:24 2011
New Revision: 225404
URL: http://svn.freebsd.org/changeset/base/225404
Log:
MFC: r225334
Fix alignment assumptions.
PR: 160289
Modified:
stable/7/tools/tools/netrate/netblast/netblast.c
stable/7/tools/tools/netrate/netsend/netsend.c
Directory Properties:
stable/7/tools/tools/netrate/netblast/ (props changed)
stable/7/tools/tools/netrate/netsend/ (props changed)
Modified: stable/7/tools/tools/netrate/netblast/netblast.c
==============================================================================
--- stable/7/tools/tools/netrate/netblast/netblast.c Mon Sep 5 17:45:22 2011 (r225403)
+++ stable/7/tools/tools/netrate/netblast/netblast.c Mon Sep 5 17:45:24 2011 (r225404)
@@ -26,6 +26,7 @@
* $FreeBSD$
*/
+#include <sys/endian.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
@@ -108,11 +109,9 @@ blast_loop(int s, long duration, u_char
* previous send, the error will turn up the current send
* operation, causing the current sequence number also to be
* skipped.
- *
- * XXXRW: Note alignment assumption.
*/
if (packet_len >= 4) {
- *((u_int32_t *)packet) = htonl(counter);
+ be32enc(packet, counter);
counter++;
}
if (send(s, packet, packet_len, 0) < 0)
Modified: stable/7/tools/tools/netrate/netsend/netsend.c
==============================================================================
--- stable/7/tools/tools/netrate/netsend/netsend.c Mon Sep 5 17:45:22 2011 (r225403)
+++ stable/7/tools/tools/netrate/netsend/netsend.c Mon Sep 5 17:45:24 2011 (r225404)
@@ -26,6 +26,7 @@
* $FreeBSD$
*/
+#include <sys/endian.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
@@ -203,11 +204,9 @@ timing_loop(struct _a *a)
* skipped.
* The counter is incremented only on the initial port number,
* so all destinations will see the same set of packets.
- *
- * XXXRW: Note alignment assumption.
*/
if (cur_port == a->port && a->packet_len >= 4) {
- *((u_int32_t *)a->packet) = htonl(counter);
+ be32enc(a->packet, counter);
counter++;
}
if (a->port == a->port_max) { /* socket already bound */
More information about the svn-src-all
mailing list