Subject: pkg/22915: Portability (libpcap) fixes for security/sniff
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <jonathan@perkin.org.uk>
List: netbsd-bugs
Date: 09/23/2003 13:27:17
>Number:         22915
>Category:       pkg
>Synopsis:       Portability (libpcap) fixes for security/sniff
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Sep 23 13:28:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Jonathan Perkin
>Release:        N/A
>Organization:
British Broadcasting Corporation
>Environment:
SunOS build1 5.9 Generic_112233-01 sun4u sparc SUNW,UltraSPARC-IIi-cEngine
>Description:
sniff needs libpcap on non-BSD platforms, so do some buildlink2 magic
to use that as required.  While here fix network library problems on
Solaris.
>How-To-Repeat:
===> Building for sniff-2.0
/home/jonp/pkg/gcc-3.3/bin/gcc -O   -c sniff2.c
In file included from sniff2.c:1:
sniff2.h:12:18: pcap.h: No such file or directory
In file included from sniff2.c:1:
sniff2.h:51: warning: `struct pcap_pkthdr' declared inside parameter list
sniff2.h:51: warning: its scope is only this definition or declaration, which is probably not what you want
sniff2.c:9: error: parse error before '*' token
sniff2.c:9: warning: data definition has no type or storage class
sniff2.c: In function `main':
sniff2.c:35: error: `pcap_handler' undeclared (first use in this function)
sniff2.c:35: error: (Each undeclared identifier is reported only once
sniff2.c:35: error: for each function it appears in.)
sniff2.c:35: error: parse error before "readTCP"
sniff2.c: At top level:
sniff2.c:8: error: storage size of `ph' isn't known
*** Error code 1
>Fix:
http://www.perkin.org.uk/projects/netbsd/sniff.diff

Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/security/sniff/Makefile,v
retrieving revision 1.7
diff -u -r1.7 Makefile
--- Makefile	2003/07/17 22:53:16	1.7
+++ Makefile	2003/09/23 13:20:27
@@ -8,4 +8,13 @@
 MAINTAINER=	zuntum@NetBSD.org
 COMMENT=	Program to sniff logins and passwords
 
+USE_BUILDLINK2=	YES
+
+.include "../../mk/bsd.prefs.mk"
+
+.if ${OPSYS} == "SunOS"
+LDFLAGS+=	-lsocket -lnsl
+.endif
+
+.include "../../net/libpcap/buildlink2.mk"
 .include "../../mk/bsd.pkg.mk"
Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/security/sniff/distinfo,v
retrieving revision 1.2
diff -u -r1.2 distinfo
--- distinfo	2001/04/19 15:40:39	1.2
+++ distinfo	2003/09/23 13:20:27
@@ -2,4 +2,4 @@
 
 SHA1 (sniff-2.0.tar.gz) = 9e9ef76eaccaa6cbb3c23054a29a08dd9faed328
 Size (sniff-2.0.tar.gz) = 10720 bytes
-SHA1 (patch-aa) = e9b9dd7ade75d67a4d202b3deddd04d4593afe46
+SHA1 (patch-aa) = beca3d7be3371d41ee67134d0af52b9e339d7211
Index: patches/patch-aa
===================================================================
RCS file: /cvsroot/pkgsrc/security/sniff/patches/patch-aa,v
retrieving revision 1.2
diff -u -r1.2 patch-aa
--- patches/patch-aa	2001/03/13 14:14:41	1.2
+++ patches/patch-aa	2003/09/23 13:20:27
@@ -1,7 +1,7 @@
 $NetBSD: patch-aa,v 1.2 2001/03/13 14:14:41 zuntum Exp $
 
---- Makefile.orig	Thu Feb 15 13:47:36 2001
-+++ Makefile
+--- Makefile.orig	Thu Feb 15 12:47:36 2001
++++ Makefile	Tue Sep 23 14:17:15 2003
 @@ -1,13 +1,10 @@
  # Makefile for NetBSD
  
@@ -16,9 +16,13 @@
  OBJS  =  sniff2.o clear.o ifOpen.o lookupDNShost.o printData.o printHeader.o readTCP.o sniffData.o
  
  
-@@ -17,8 +14,8 @@
- 	$(CC) $(CFLAGS) -o sniff2 $(OBJS) -lpcap
+@@ -14,11 +11,11 @@
+ all: sniff2
  
+ sniff2: $(OBJS)
+-	$(CC) $(CFLAGS) -o sniff2 $(OBJS) -lpcap
++	$(CC) $(CFLAGS) -o sniff2 $(OBJS) $(LDFLAGS) -lpcap
+ 
  install:
 -	$(CP) sniff2 $(INSTALL_DIR)
 -	$(CP) sniff2.1 $(INSTALL_MAN)/man1
@@ -26,3 +30,4 @@
 +	$(BSD_INSTALL_MAN) sniff2.1 $(INSTALL_MAN)/man1
  clean: 
  	$(RM)  $(OBJS) sniff2
+ 
>Release-Note:
>Audit-Trail:
>Unformatted: