diff options
author | marius <marius@FreeBSD.org> | 2011-09-02 16:40:18 +0000 |
---|---|---|
committer | marius <marius@FreeBSD.org> | 2011-09-02 16:40:18 +0000 |
commit | 3cf33970bf0ab33ba3a8f7a526e67ccc47e341e6 (patch) | |
tree | 673865c10d73c25241416bcc1957062b2133d2f2 /tools | |
parent | 8e8f8c09710429a771262ed9bbbf4d2475ef30bb (diff) | |
download | FreeBSD-src-3cf33970bf0ab33ba3a8f7a526e67ccc47e341e6.zip FreeBSD-src-3cf33970bf0ab33ba3a8f7a526e67ccc47e341e6.tar.gz |
Fix alignment assumptions.
PR: 160289
Approved by: re (kib)
MFC after: 3 days
Diffstat (limited to 'tools')
-rw-r--r-- | tools/tools/netrate/netblast/netblast.c | 5 | ||||
-rw-r--r-- | tools/tools/netrate/netsend/netsend.c | 5 |
2 files changed, 4 insertions, 6 deletions
diff --git a/tools/tools/netrate/netblast/netblast.c b/tools/tools/netrate/netblast/netblast.c index 3e90126..f932fca 100644 --- a/tools/tools/netrate/netblast/netblast.c +++ b/tools/tools/netrate/netblast/netblast.c @@ -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 *packet, u_int packet_len) * 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) diff --git a/tools/tools/netrate/netsend/netsend.c b/tools/tools/netrate/netsend/netsend.c index 5e41f2d..49cd343 100644 --- a/tools/tools/netrate/netsend/netsend.c +++ b/tools/tools/netrate/netsend/netsend.c @@ -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 */ |