ports/122571: [patch] net/libnet10 does not work on amd64

Martin Beran mb at tns.cz
Tue Apr 8 14:10:01 UTC 2008


>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 at 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:



More information about the freebsd-ports-bugs mailing list