Skip site navigation (1)Skip section navigation (2)
Date:      Tue,  8 Apr 2008 15:36:51 +0200 (CEST)
From:      Martin Beran <mb@tns.cz>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/122571: [patch] net/libnet10 does not work on amd64
Message-ID:  <20080408133651.B857D1701F@mb.tns.cz>
Resent-Message-ID: <200804081410.m38EA1FP004733@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         122571
>Category:       ports
>Synopsis:       [patch] net/libnet10 does not work on amd64
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Apr 08 14:10:00 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Martin Beran
>Release:        FreeBSD 6.2-RELEASE-p11 amd64
>Organization:
Trusted Network Solutions, a. s.
>Environment:
FreeBSD pha.tns.cz 6.2-RELEASE-p11 FreeBSD 6.2-RELEASE-p11 #12: Thu Feb 14 23:55:18 CET 2008     root@pha.tns.cz:/usr/obj/usr/src/sys/PHA  amd64
libnet10-1.0.2a_4,1

>Description:
Library net/libnet10 defines structures for contents of network packets.
Fields of the packets have fixed size according to the respective protocol
definitions, but the library uses type u_long for some of the 32bit fields.
This is a problem on amd64 architecture, where type long has 64 bits. On
amd64, libnet creates packets with bad contents.

>How-To-Repeat:
Try to send network packets created by net/libnet10. For example, Snort in
inline mode uses libnet to send TCP reset if a packet matches a reject rule.
The packets are invalid, which can be easily seen by tcpdump.

>Fix:

--- ports.net.libnet10-1.0.2a_4,1.patch begins here ---
--- Makefile.orig	Tue Apr  8 14:55:03 2008
+++ Makefile	Tue Apr  8 15:00:06 2008
@@ -23,6 +23,13 @@
 DOCSDIR=	${PREFIX}/share/doc/${PORTNAME}${PKGNAMESUFFIX}
 MAN3=		libnet${PKGNAMESUFFIX}.3
 
+.include <bsd.port.pre.mk>
+
+.if ${ARCH} == "amd64"
+post-patch:
+	find ${WRKDIR} -name '*.[hc]' | xargs ${REINPLACE_CMD} -e 's/long/int/g'
+.endif
+
 post-install:
 	${INSTALL_MAN} ${WRKSRC}/doc/libnet.3 \
 		${MANPREFIX}/man/man3/libnet${PKGNAMESUFFIX}.3
@@ -39,4 +46,4 @@
 .endfor
 .endif
 
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>
--- ports.net.libnet10-1.0.2a_4,1.patch ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080408133651.B857D1701F>