diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-04-14 10:14:25 -0700 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-04-14 10:14:25 -0700 |
commit | 0ecc11659285337c0430f1b7004eb3b2901a93d3 (patch) | |
tree | 2d18e7be993b0b720b41b4e72601cb3c608f00a7 | |
parent | 8597da193474673a3caeffcf3d134bb2ed57aa4d (diff) | |
download | busybox-w32-0ecc11659285337c0430f1b7004eb3b2901a93d3.tar.gz busybox-w32-0ecc11659285337c0430f1b7004eb3b2901a93d3.tar.bz2 busybox-w32-0ecc11659285337c0430f1b7004eb3b2901a93d3.zip |
dnsd: enforce alignment on packet buffer
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | include/platform.h | 2 | ||||
-rw-r--r-- | networking/dnsd.c | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/include/platform.h b/include/platform.h index 2d3821c02..f87add552 100644 --- a/include/platform.h +++ b/include/platform.h | |||
@@ -281,10 +281,12 @@ typedef unsigned smalluint; | |||
281 | #if 1 /* if needed: !defined(arch1) && !defined(arch2) */ | 281 | #if 1 /* if needed: !defined(arch1) && !defined(arch2) */ |
282 | # define ALIGN1 __attribute__((aligned(1))) | 282 | # define ALIGN1 __attribute__((aligned(1))) |
283 | # define ALIGN2 __attribute__((aligned(2))) | 283 | # define ALIGN2 __attribute__((aligned(2))) |
284 | # define ALIGN4 __attribute__((aligned(4))) | ||
284 | #else | 285 | #else |
285 | /* Arches which MUST have 2 or 4 byte alignment for everything are here */ | 286 | /* Arches which MUST have 2 or 4 byte alignment for everything are here */ |
286 | # define ALIGN1 | 287 | # define ALIGN1 |
287 | # define ALIGN2 | 288 | # define ALIGN2 |
289 | # define ALIGN4 | ||
288 | #endif | 290 | #endif |
289 | 291 | ||
290 | 292 | ||
diff --git a/networking/dnsd.c b/networking/dnsd.c index 6771c5346..c76a54f9e 100644 --- a/networking/dnsd.c +++ b/networking/dnsd.c | |||
@@ -480,7 +480,8 @@ int dnsd_main(int argc UNUSED_PARAM, char **argv) | |||
480 | unsigned lsa_size; | 480 | unsigned lsa_size; |
481 | int udps, opts; | 481 | int udps, opts; |
482 | uint16_t port = 53; | 482 | uint16_t port = 53; |
483 | uint8_t buf[MAX_PACK_LEN + 1]; | 483 | /* Ensure buf is 32bit aligned (we need 16bit, but 32bit can't hurt) */ |
484 | uint8_t buf[MAX_PACK_LEN + 1] ALIGN4; | ||
484 | 485 | ||
485 | opts = getopt32(argv, "vsi:c:t:p:d", &listen_interface, &fileconf, &sttl, &sport); | 486 | opts = getopt32(argv, "vsi:c:t:p:d", &listen_interface, &fileconf, &sttl, &sport); |
486 | //if (opts & (1 << 0)) // -v | 487 | //if (opts & (1 << 0)) // -v |