Hi,
patch below updates driftnet to 1.0 version.
New version is not from the original author, but from a Ubuntu package,
downloaded from launchpad.
Notably new features compared to the current version in the ports tree:
* PNG image support
* IPv6 support
* reading from pcap file
Works for me on amd64 and i386.
tests, comments or even OKs welcome.
cheers,
Sebastian
Index: Makefile
===================================================================
RCS file: /cvs/ports/x11/driftnet/Makefile,v
retrieving revision 1.12
diff -u -p -u -r1.12 Makefile
--- Makefile 11 Mar 2013 11:46:09 -0000 1.12
+++ Makefile 22 Jun 2013 12:13:38 -0000
@@ -1,9 +1,10 @@
-# $OpenBSD: Makefile,v 1.12 2013/03/11 11:46:09 espie Exp $
+# $OpenBSD: Makefile,v 1.11 2012/12/23 13:25:11 sthen Exp $
COMMENT= network sniffer that grabs and displays images
-DISTNAME= driftnet-0.1.6
-REVISION= 4
+VERSION = 1.0
+DISTNAME= driftnet_${VERSION}.orig
+PKGNAME= driftnet-${VERSION}
CATEGORIES= x11
HOMEPAGE= http://www.ex-parrot.com/~chris/driftnet/
@@ -13,23 +14,21 @@ MAINTAINER= Claudio Jeker <claudio@openb
# GPL
PERMIT_PACKAGE_CDROM= Yes
-MASTER_SITES= http://www.ex-parrot.com/~chris/driftnet/
+MASTER_SITES= https://launchpad.net/ubuntu/+archive/primary/+files/
-WANTLIB += X11 Xcomposite Xcursor Xdamage Xext Xfixes
-WANTLIB += Xi Xinerama Xrandr Xrender atk-1.0 c cairo expat fontconfig
-WANTLIB += freetype gio-2.0 glib-2.0 gobject-2.0
-WANTLIB += m pango-1.0 pangocairo-1.0 pangoft2-1.0 pcap pixman-1
-WANTLIB += png pthread pthread-stubs xcb z ungif jpeg gdk_pixbuf-2.0
-WANTLIB += gdk-x11-2.0 gtk-x11-2.0 GL xcb-render xcb-shm
-
-MODULES= devel/gettext
+WANTLIB += c m pcap gif png pthread z jpeg
+WANTLIB += glib-2.0 gobject-2.0 gdk-x11-2.0 gtk-x11-2.0
LIB_DEPENDS= graphics/libungif \
graphics/jpeg \
x11/gtk+2
-USE_GROFF = Yes
-
NO_TEST= Yes
+
+WRKDIST = ${WRKDIR}/${PKGNAME}
+
+CONFIGURE_STYLE = gnu
+CONFIGURE_ENV = CPPFLAGS="-I${LOCALBASE}/include/gtk-2.0" \
+ LDFLAGS="-L${LOCALBASE}/lib -L${X11BASE}/lib -lm -lz"
.include <bsd.port.mk>
Index: distinfo
===================================================================
RCS file: /cvs/ports/x11/driftnet/distinfo,v
retrieving revision 1.1.1.1
diff -u -p -u -r1.1.1.1 distinfo
--- distinfo 30 Apr 2007 13:38:50 -0000 1.1.1.1
+++ distinfo 22 Jun 2013 12:13:38 -0000
@@ -1,5 +1,2 @@
-MD5 (driftnet-0.1.6.tar.gz) = jhHXd3BFL5e7PCP1EEiYFQ==
-RMD160 (driftnet-0.1.6.tar.gz) = AQV/PLmS+qU3qLGI4RbG8hAWz6w=
-SHA1 (driftnet-0.1.6.tar.gz) = J5yzpZbzVOfpxqw8xFaz0R3O0v8=
-SHA256 (driftnet-0.1.6.tar.gz) = 299+rTrhSxCfiMht7et1JL6MJXqnc6eBiRIW8BM3PW0=
-SIZE (driftnet-0.1.6.tar.gz) = 36989
+SHA256 (driftnet_1.0.orig.tar.gz) =
suZ17EyO7BJhmNQBCIC1edcozxflIQbX9A8KE1AA6qc=
+SIZE (driftnet_1.0.orig.tar.gz) = 151184
Index: patches/patch-Makefile
===================================================================
RCS file: patches/patch-Makefile
diff -N patches/patch-Makefile
--- patches/patch-Makefile 20 Mar 2010 16:52:08 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,84 +0,0 @@
-$OpenBSD: patch-Makefile,v 1.2 2010/03/20 16:52:08 jasper Exp $
---- Makefile.orig Tue Jul 9 21:26:41 2002
-+++ Makefile Fri Jan 29 16:15:17 2010
-@@ -16,23 +16,23 @@
- #CC = gcc
-
- # Basic compiler, linker flags; should not need any changes.
--CFLAGS += -g -Wall
--LDFLAGS += -g
-+#CFLAGS += -g -Wall
-+#LDFLAGS += -g
-
- # You might need these if libpcap is installed somewhere random.
--CFLAGS += -I/usr/include/pcap
-+CFLAGS += -I/usr/local/include
- #LDFLAGS += -L/path/to/libpcap.so
-
- # Required on Linux to get BSDish definitions of the TCP/IP structs.
--CFLAGS += -D_BSD_SOURCE
-+#CFLAGS += -D_BSD_SOURCE
-
- # We always need the pcap and pthread libraries.
--LDLIBS += -lpcap -lpthread
-+LDLIBS += -lpcap -pthread
-
- # Optional C compiler and linker flags. Typical driftnet builds have support
- # for displaying captured images in an X window, and need the following flags:
--CFLAGS += `gtk-config --cflags`
--LDLIBS += -ljpeg -lungif `gtk-config --libs`
-+CFLAGS += `pkg-config --cflags gtk+-2.0`
-+LDLIBS += -ljpeg -lungif `pkg-config --libs gtk+-2.0`
-
- # Alternatively, you can build a version of driftnet which can only be used
- # in `adjunct' mode as the back end for some other image-processing program.
To
-@@ -72,23 +72,17 @@ BINS = driftnet
-
- OBJS = $(SRCS:.c=.o)
-
--default: driftnet driftnet.1
-+all: driftnet driftnet.1
-
--driftnet: depend $(OBJS)
-+driftnet: $(OBJS)
- $(CC) -o driftnet $(OBJS) $(LDFLAGS) $(LDLIBS)
-
- driftnet.1: driftnet.1.in Makefile
- ( echo '.\" DO NOT EDIT THIS FILE-- edit driftnet.1.in instead' ; sed
s/@@@VERSION@@@/$(VERSION)/ ) < driftnet.1.in > driftnet.1
-
--endianness: endian
-- ./endian > endianness
-+%.o: %.c Makefile
-+ $(CC) $(CFLAGS) -c -o $@ $<
-
--endian: endian.c
-- $(CC) $(CFLAGS) -o endian endian.c
--
--%.o: %.c Makefile endianness
-- $(CC) $(CFLAGS) `cat endianness` -c -o $@ $<
--
- clean: nodepend
- rm -f *~ *.bak *.o core $(BINS) TAGS driftnet.1 endian endianness
-
-@@ -102,13 +96,19 @@ tarball: nodepend $(SRCS) $(HDRS) $(TXTS)
- rm -rf driftnet-$(VERSION)
- mv driftnet-$(VERSION).tar.gz ..
-
--depend: endianness
-- makedepend -- $(CFLAGS) `cat endianness` -- $(SRCS)
-+depend:
-+ makedepend -- $(CFLAGS) -- $(SRCS)
- touch depend
- rm -f Makefile.bak
-
- nodepend:
- makedepend -- --
- rm -f depend Makefile.bak
-+
-+install:
-+ ${INSTALL} ${INSTALL_COPY} ${INSTALL_STRIP} -o ${BINOWN} -g ${BINGRP} \
-+ -m ${BINMODE} driftnet ${PREFIX}/bin/driftnet
-+ ${INSTALL} ${INSTALL_COPY} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} \
-+ driftnet.1 ${PREFIX}/man/man1/driftnet.1
-
- # DO NOT DELETE
Index: patches/patch-Makefile_in
===================================================================
RCS file: patches/patch-Makefile_in
diff -N patches/patch-Makefile_in
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-Makefile_in 22 Jun 2013 12:13:38 -0000
@@ -0,0 +1,21 @@
+$OpenBSD$
+--- Makefile.in.orig Sun May 12 18:33:18 2013
++++ Makefile.in Fri Jun 21 09:38:27 2013
+@@ -258,7 +258,7 @@ top_srcdir = @top_srcdir@
+ SUBDIRS = src
+ dist_doc_DATA = README TODO
+ EXTRA_DIST = driftnet.1.in CHANGES CREDITS
+-MANPAGE = driftnet.1.gz
++MANPAGE = driftnet.1
+ MAN1DIR = $(DESTDIR)$(mandir)/man1/
+ all: all-recursive
+
+@@ -773,7 +773,7 @@ clean-local:
+ rm -f $(MANPAGE)
+
+ install-data-local: driftnet.1.in
+- cat $(srcdir)/driftnet.1.in | sed s/@*VERSION@*/$(VERSION)/ |
GZIP=$(GZIP_ENV) gzip > $(MANPAGE)
++ cat $(srcdir)/driftnet.1.in | sed s/@*VERSION@*/$(VERSION)/ > $(MANPAGE)
+ $(MKDIR_P) $(MAN1DIR)
+ $(INSTALL_DATA) $(MANPAGE) $(MAN1DIR) || exit $$?
+
Index: patches/patch-img_h
===================================================================
RCS file: patches/patch-img_h
diff -N patches/patch-img_h
--- patches/patch-img_h 30 Apr 2007 13:38:50 -0000 1.1.1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,29 +0,0 @@
-$OpenBSD: patch-img_h,v 1.1.1.1 2007/04/30 13:38:50 claudio Exp $
---- img.h.orig Tue Apr 24 14:45:52 2007
-+++ img.h Tue Apr 24 14:47:02 2007
-@@ -20,13 +20,15 @@
- # include <stdint.h> /* C99 standard */
- #endif
-
-+#include <sys/endian.h>
-+
- #include <stdio.h>
-
- typedef uint8_t chan;
- typedef uint32_t pel;
-
- /* Yuk. GDKRGB expects data in a specific ordering. */
--#if defined(DRIFTNET_LITTLE_ENDIAN)
-+#if defined(_LITTLE_ENDIAN)
- # define PEL(r, g, b) ((pel)((chan)(r) | ((chan)(g) << 8) |
((chan)(b) << 16)))
- # define PELA(r, g, b, a) ((pel)((chan)(r) | ((chan)(g) << 8) |
((chan)(b) << 16) | ((chan)(a) << 24)))
-
-@@ -34,7 +36,7 @@ typedef uint32_t pel;
- # define GETG(p) ((chan)(((p) & (pel)0x0000ff00) >> 8))
- # define GETB(p) ((chan)(((p) & (pel)0x00ff0000) >> 16))
- # define GETA(p) ((chan)(((p) & (pel)0xff000000) >> 24))
--#elif defined(DRIFTNET_BIG_ENDIAN)
-+#elif defined(_BIG_ENDIAN)
- # define PEL(r, g, b) ((pel)(((chan)(r) << 24) | ((chan)(g) << 16) |
((chan)(b) << 8)))
- # define PELA(r, g, b, a) ((pel)(((chan)(r) << 24) | ((chan)(g) << 16) |
((chan)(b) << 8) | ((chan)(a))))
-
Index: patches/patch-src_display_img_h
===================================================================
RCS file: patches/patch-src_display_img_h
diff -N patches/patch-src_display_img_h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_display_img_h 22 Jun 2013 12:13:38 -0000
@@ -0,0 +1,27 @@
+$OpenBSD$
+--- src/display/img.h.orig Fri Jun 21 08:45:24 2013
++++ src/display/img.h Fri Jun 21 08:46:00 2013
+@@ -19,11 +19,13 @@
+
+ #include <stdio.h>
+
++#include <sys/endian.h>
++
+ typedef uint8_t chan;
+ typedef uint32_t pel;
+
+ /* Yuk. GDKRGB expects data in a specific ordering. */
+-#if defined(DRIFTNET_LITTLE_ENDIAN)
++#if defined(LITTLE_ENDIAN)
+ # define PEL(r, g, b) ((pel)((chan)(r) | ((chan)(g) << 8) |
((chan)(b) << 16)))
+ # define PELA(r, g, b, a) ((pel)((chan)(r) | ((chan)(g) << 8) |
((chan)(b) << 16) | ((chan)(a) << 24)))
+
+@@ -31,7 +33,7 @@ typedef uint32_t pel;
+ # define GETG(p) ((chan)(((p) & (pel)0x0000ff00) >> 8))
+ # define GETB(p) ((chan)(((p) & (pel)0x00ff0000) >> 16))
+ # define GETA(p) ((chan)(((p) & (pel)0xff000000) >> 24))
+-#elif defined(DRIFTNET_BIG_ENDIAN)
++#elif defined(BIG_ENDIAN)
+ # define PEL(r, g, b) ((pel)(((chan)(r) << 24) | ((chan)(g) << 16) |
((chan)(b) << 8)))
+ # define PELA(r, g, b, a) ((pel)(((chan)(r) << 24) | ((chan)(g) << 16) |
((chan)(b) << 8) | ((chan)(a))))
+
Index: patches/patch-src_display_png_c
===================================================================
RCS file: patches/patch-src_display_png_c
diff -N patches/patch-src_display_png_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_display_png_c 22 Jun 2013 12:13:38 -0000
@@ -0,0 +1,19 @@
+$OpenBSD$
+
+png_set_gray_1_2_4_to_8 doesn't seem to exist in newer
+png anymore
+
+--- src/display/png.c.orig Fri Jun 21 09:29:56 2013
++++ src/display/png.c Fri Jun 21 09:30:09 2013
+@@ -132,9 +132,9 @@ int png_load_img(img I) {
+ /* Convert greyscale images to 8-bit RGB */
+ if (color_type == PNG_COLOR_TYPE_GRAY ||
+ color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
+- if (bit_depth < 8) {
++ /* if (bit_depth < 8) {
+ png_set_gray_1_2_4_to_8(png_ptr);
+- }
++ } */
+ png_set_gray_to_rgb(png_ptr);
+ }
+
Index: patches/patch-src_layer2_c
===================================================================
RCS file: patches/patch-src_layer2_c
diff -N patches/patch-src_layer2_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_layer2_c 22 Jun 2013 12:13:38 -0000
@@ -0,0 +1,35 @@
+$OpenBSD$
+
+include the right headers, and define a struct ethhdr
+like its available on Linux
+
+--- src/layer2.c.orig Fri Jun 21 08:58:51 2013
++++ src/layer2.c Fri Jun 21 09:12:06 2013
+@@ -3,7 +3,10 @@
+ #include <string.h>
+ #include <assert.h>
+
+-#include <netinet/ether.h>
++//#include <netinet/ether.h>
++#include <sys/types.h>
++#include <netinet/in_systm.h>
++#include <netinet/in.h>
+ #include <netinet/ip.h>
+ #include <netinet/ip6.h>
+
+@@ -11,6 +14,15 @@
+
+ #include "log.h"
+ #include "layer2.h"
++
++#define ETH_P_IP 0x0800
++#define ETH_P_IPV6 0x86DD
++#define ETH_ALEN 6
++struct ethhdr {
++ unsigned char h_dest[ETH_ALEN];
++ unsigned char h_source[ETH_ALEN];
++ u_int16_t h_proto;
++} __attribute__((packed));
+
+ int handle_link_layer(datalink_info_t *info, const u_char *pkt, uint8_t
*nextproto,
+ int *offsetnext)
Index: patches/patch-src_layer3_c
===================================================================
RCS file: patches/patch-src_layer3_c
diff -N patches/patch-src_layer3_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_layer3_c 22 Jun 2013 12:13:38 -0000
@@ -0,0 +1,19 @@
+$OpenBSD$
+
+import right headers
+
+--- src/layer3.c.orig Fri Jun 21 09:12:25 2013
++++ src/layer3.c Fri Jun 21 09:22:48 2013
+@@ -3,8 +3,12 @@
+ #include <string.h>
+ #include <assert.h>
+
++#include <sys/types.h>
++#include <netinet/in_systm.h>
++#include <netinet/in.h>
+ #include <netinet/ip.h>
+ #include <netinet/ip6.h>
++#include <sys/socket.h>
+
+ #include "log.h"
+ #include "layer3.h"
Index: pkg/DESCR
===================================================================
RCS file: /cvs/ports/x11/driftnet/pkg/DESCR,v
retrieving revision 1.1.1.1
diff -u -p -u -r1.1.1.1 DESCR
--- pkg/DESCR 30 Apr 2007 13:38:50 -0000 1.1.1.1
+++ pkg/DESCR 22 Jun 2013 12:13:38 -0000
@@ -1,3 +1,3 @@
-Driftnet watches network traffic, and picks out and displays JPEG and
-GIF images for display. It can also extract MPEG audio data from the
-network and play it with an external helper app. Use at own risk.
+Driftnet watches network traffic, and picks out and displays JPEG, PNG
+and GIF images for display. It can also extract MPEG audio data from
+the network and play it with an external helper app. Use at own risk.
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/x11/driftnet/pkg/PLIST,v
retrieving revision 1.2
diff -u -p -u -r1.2 PLIST
--- pkg/PLIST 20 Mar 2010 16:52:08 -0000 1.2
+++ pkg/PLIST 22 Jun 2013 12:13:38 -0000
@@ -1,3 +1,6 @@
@comment $OpenBSD: PLIST,v 1.2 2010/03/20 16:52:08 jasper Exp $
@bin bin/driftnet
@man man/man1/driftnet.1
+share/doc/driftnet/
+share/doc/driftnet/README
+share/doc/driftnet/TODO