[dns-operations] dnscap update
Stephane Bortzmeyer
bortzmeyer at nic.fr
Thu May 3 20:00:53 UTC 2007
On Thu, May 03, 2007 at 04:59:38PM +0000,
Paul Vixie <paul at vix.com> wrote
a message of 18 lines which said:
> i also fixed the alignment problem marka described
It does not work for me, my picky 64-bits machine still segfaults. The
attached patch solves it (you will note I'm an old and conservative
guy and that I prefer the simple memcpy to advanced C pointer magic).
Patch tested on Debian/i386, Gentoo/amd64 and NetBSD/UltraSparc.
> note that this still lacks the #include changes bortzmeyer at nic.fr
> recommended for netbsd, since i'd like them with #ifdef'd
Done.
-------------- next part --------------
Index: dnscap.c
===================================================================
RCS file: /proj/cvsroot/dnscap/dnscap.c,v
retrieving revision 1.2
diff -u -r1.2 dnscap.c
--- dnscap.c 3 May 2007 16:55:05 -0000 1.2
+++ dnscap.c 3 May 2007 19:50:31 -0000
@@ -38,7 +38,13 @@
# define _GNU_SOURCE
#endif
+#ifndef __NetBSD__
#include <net/ethernet.h>
+#else
+#include <net/ethertypes.h>
+#include <net/if.h>
+#include <net/if_ether.h>
+#endif
#include <netinet/in_systm.h>
#include <netinet/in.h>
#include <netinet/ip.h>
@@ -914,7 +920,7 @@
/* Application. */
if (len < sizeof dns)
return;
- dns = *(HEADER *)pkt;
+ memcpy(&dns, pkt, sizeof(dns));
/* Policy filtering. */
if (!ISC_LIST_EMPTY(vlans)) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <https://lists.dns-oarc.net/pipermail/dns-operations/attachments/20070503/511fc503/attachment.sig>
More information about the dns-operations
mailing list