prevent unaligned access, makes it work on sparc64.

help from naddy@
This commit is contained in:
steven 2010-10-26 10:44:53 +00:00
parent 8dd881a111
commit a5c465b3d3
2 changed files with 22 additions and 3 deletions

View File

@ -1,10 +1,10 @@
# $OpenBSD: Makefile,v 1.3 2010/10/26 07:59:28 ajacoutot Exp $
# $OpenBSD: Makefile,v 1.4 2010/10/26 10:44:53 steven Exp $
COMMENT = framework for analysis of layer 2 network protocols
DISTNAME = yersinia-0.7.1
CATEGORIES = net security
REVISION = 0
REVISION = 1
HOMEPAGE = http://www.yersinia.net/
@ -26,7 +26,8 @@ CONFIGURE_STYLE = gnu
CONFIGURE_ARGS = --disable-gtk \
--with-libnet-includes=${LOCALBASE}/include/libnet-1.1
CONFIGURE_ENV = LDFLAGS="-L${LOCALBASE}/lib" \
LIBNET_CONFIG=${LOCALBASE}/bin/libnet-config-1.1
LIBNET_CONFIG=${LOCALBASE}/bin/libnet-config-1.1 \
CPPFLAGS="${CPPFLAGS} -DLBL_ALIGN"
post-install:
${INSTALL_DATA_DIR} ${PREFIX}/share/doc/yersinia

View File

@ -0,0 +1,18 @@
$OpenBSD: patch-src_attack_c,v 1.1 2010/10/26 10:44:53 steven Exp $
--- src/attack.c.orig Tue Oct 26 12:04:42 2010
+++ src/attack.c Tue Oct 26 12:13:45 2010
@@ -248,8 +248,12 @@ attacks->attack_th.id);
void
attack_gen_mac(u_int8_t *mac)
{
- *((in_addr_t *)mac) = libnet_get_prand(LIBNET_PRu32);
- *((u_int16_t *)(mac + 4)) = libnet_get_prand(LIBNET_PRu16);
+ u_int32_t tmp1;
+ u_int16_t tmp2;
+ tmp1 = libnet_get_prand(LIBNET_PRu32);
+ memcpy(mac, &tmp1, sizeof(tmp1));
+ tmp2 = libnet_get_prand(LIBNET_PRu16);
+ memcpy(mac + 4, &tmp2, sizeof(tmp2));
}