]> git.ipfire.org Git - people/ummeegge/ipfire-2.x.git/commitdiff
tcpick: Renewed version with several patches. tcpick
authorErik Kapfer <erik.kapfer@ipfire.org>
Sun, 24 Sep 2017 14:37:00 +0000 (16:37 +0200)
committerErik Kapfer <erik.kapfer@ipfire.org>
Sun, 24 Sep 2017 14:37:00 +0000 (16:37 +0200)
Patches has been included for:
- Fix for CVE-2006-0048
- Fix for build with GCC 5.
- Fix for double free error.
- Fix for man invocation.
- Fix for timestamp pcap header structure.

config/rootfiles/packages/tcpick [new file with mode: 0644]
lfs/tcpick [new file with mode: 0644]
make.sh
src/patches/tcpick/001-CVE-2006-0048.patch [new file with mode: 0644]
src/patches/tcpick/002-fix-build-with-gcc5.patch [new file with mode: 0644]
src/patches/tcpick/003-fix-double-free-error.patch [new file with mode: 0644]
src/patches/tcpick/004-fix-man-invocation.patch [new file with mode: 0644]
src/patches/tcpick/005-set-timestamp-pcap-header-structure.patch [new file with mode: 0644]
src/patches/tcpick/006-avoid-implicitly-converted-pointers.patch [new file with mode: 0644]

diff --git a/config/rootfiles/packages/tcpick b/config/rootfiles/packages/tcpick
new file mode 100644 (file)
index 0000000..d0bc1b1
--- /dev/null
@@ -0,0 +1,3 @@
+usr/bin/tcpick
+#usr/share/man/man8/tcpick.8
+#usr/share/man/man8/tcpick_italian.8
diff --git a/lfs/tcpick b/lfs/tcpick
new file mode 100644 (file)
index 0000000..55d11b0
--- /dev/null
@@ -0,0 +1,94 @@
+###############################################################################
+#                                                                             #
+# IPFire.org - A linux based firewall                                         #
+# Copyright (C) 2007  Michael Tremer & Christian Schmidt                      #
+#                                                                             #
+# This program is free software: you can redistribute it and/or modify        #
+# it under the terms of the GNU General Public License as published by        #
+# the Free Software Foundation, either version 3 of the License, or           #
+# (at your option) any later version.                                         #
+#                                                                             #
+# This program is distributed in the hope that it will be useful,             #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+# GNU General Public License for more details.                                #
+#                                                                             #
+# You should have received a copy of the GNU General Public License           #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+###############################################################################
+
+###############################################################################
+# Definitions
+###############################################################################
+
+include Config
+
+VER        = 0.2.1
+
+THISAPP    = tcpick-$(VER)
+DL_FILE    = $(THISAPP).tar.gz
+DL_FROM    = $(URL_IPFIRE)
+DIR_APP    = $(DIR_SRC)/$(THISAPP)
+TARGET     = $(DIR_INFO)/$(THISAPP)
+PROG       = tcpick
+PAK_VER    = 1
+
+DEPS       = ""
+
+###############################################################################
+# Top-level Rules
+###############################################################################
+
+objects = $(DL_FILE)
+
+$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
+
+$(DL_FILE)_MD5 = bb94f2f9ea81aeb645619fbe9b3b9a29
+
+install : $(TARGET)
+
+check : $(patsubst %,$(DIR_CHK)/%,$(objects))
+
+download :$(patsubst %,$(DIR_DL)/%,$(objects))
+
+md5 : $(subst %,%_MD5,$(objects))
+
+dist: 
+       @$(PAK)
+
+###############################################################################
+# Downloading, checking, md5sum
+###############################################################################
+
+$(patsubst %,$(DIR_CHK)/%,$(objects)) :
+       @$(CHECK)
+
+$(patsubst %,$(DIR_DL)/%,$(objects)) :
+       @$(LOAD)
+
+$(subst %,%_MD5,$(objects)) :
+       @$(MD5)
+
+###############################################################################
+# Installation Details
+###############################################################################
+
+$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
+       @$(PREBUILD)
+       @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
+
+       cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/tcpick/001-CVE-2006-0048.patch
+       cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/tcpick/002-fix-build-with-gcc5.patch
+       cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/tcpick/003-fix-double-free-error.patch
+       cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/tcpick/004-fix-man-invocation.patch
+       cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/tcpick/005-set-timestamp-pcap-header-structure.patch
+       cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/tcpick/006-avoid-implicitly-converted-pointers.patch
+
+       cd $(DIR_APP) && ./autogen.sh
+       cd $(DIR_APP) && ./configure --prefix=/usr
+       cd $(DIR_APP) && make $(MAKETUNING)
+       cd $(DIR_APP) && make install
+
+       @rm -rf $(DIR_APP)
+       @$(POSTBUILD)
diff --git a/make.sh b/make.sh
index f79f6276ac1325ba2c183321a65e8cfce0ece41c..239add848f95766f59d110ed885955fce3a9c2f8 100755 (executable)
--- a/make.sh
+++ b/make.sh
@@ -887,6 +887,7 @@ buildipfire() {
   lfsmake2 perl-Net-IP
   lfsmake2 wio
   lfsmake2 iftop
+  lfsmake2 tcpick
 }
 
 buildinstaller() {
diff --git a/src/patches/tcpick/001-CVE-2006-0048.patch b/src/patches/tcpick/001-CVE-2006-0048.patch
new file mode 100644 (file)
index 0000000..29ba2e1
--- /dev/null
@@ -0,0 +1,19 @@
+Description: Fix for CVE-2006-0048
+Author: Cédric Delfosse <cedric@debian.org>
+Origin: vendor
+Bug-Debian: http://bugs.debian.org/360571
+Last-Update: 2006-04-14
+
+diff -Nur tcpick-0.2.1_orig/src/write.c tcpick-0.2.1/src/write.c
+--- tcpick-0.2.1_orig/src/write.c      2005-01-09 00:54:47.000000000 +0100
++++ tcpick-0.2.1/src/write.c   2017-09-20 12:31:14.735311570 +0200
+@@ -241,6 +241,9 @@
+       if( flags.separator && ( out == stdout ) ) /* FIXME: sucks? */
+               color( c_SEPARATOR, stdout, SEPARATOR "\n" );
++      /* Temporary fix for CVE-2006-0048 */
++      if (buflen < 0) buflen = 0;
++
+       switch ( flavour ) {
+       case HEX_ASCII_DUMP:
+               out_xa( out, buf, buflen );
diff --git a/src/patches/tcpick/002-fix-build-with-gcc5.patch b/src/patches/tcpick/002-fix-build-with-gcc5.patch
new file mode 100644 (file)
index 0000000..eefc56f
--- /dev/null
@@ -0,0 +1,233 @@
+Description: Fix build with GCC        5
+ GCC 5 is more picky with external references which are not properly
+ declared with forward references. Add all relevant functions to tcpick.h
+ to avoid this problem and fix the problems put into light by this change
+ (some invalid function calls).
+Author: Raphaël Hertzog <hertzog@debian.org>
+Bug-Debian: http://bugs.debian.org/778141
+Origin: vendor
+Last-Update: 2015-07-13
+
+--- a/src/tcpick.h
++++ b/src/tcpick.h
+@@ -10,10 +10,12 @@
+  */
+ #include "config.h"
++#define _GNU_SOURCE
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <unistd.h>
++#include <ctype.h>
+ #ifdef HAVE_SIGNAL_H
+ # include <signal.h>
+@@ -114,3 +116,102 @@
+ #include "flags.h"
+ #include "lookup.h"
+ #include "timer.h"
++
++/* From args.c */
++void parse_args(int argc, char ** argv);
++
++/* From colors.c */
++void textcolor(FILE * out, int attr, int fg, int bg);
++void resetcolor(FILE * out);
++void color(int attr, int fg, FILE * out, char *fmt, ...);
++
++/* From datalink.c */
++char *datalink2str(int dl_id);
++int datalink2off(int dl_id);
++
++/* From display.c */
++char * status2str(enum STATUS status);
++int display_status( FILE * out, struct CONN * conn, enum STATUS status );
++int display_header( FILE * out );
++int out_h( FILE * out, u_char * buf, int buflen );
++int out_hn( FILE * out, u_char * buf, int buflen );
++int out_p( FILE * out, u_char * buf, int buflen );
++int out_xa (FILE * out, u_char * buf, int buflen);
++int out_x (FILE * out, u_char * buf, int buflen);
++
++/* From fragments.c */
++int
++addfr( struct FRAGMENT ** first,
++       int wlen,
++       u_int32_t data_off,
++       u_char * payload,
++       int payload_len );
++
++int
++flush_ack( struct HOST_DESC * desc,
++           struct CONN * conn_ptr,
++           int ack_num );
++
++/* From lookup_query.c */
++char * lookup_new(struct in_addr ia);
++char * lookup(struct in_addr ia);
++char * getportname(u_int16_t port);
++
++/* From lookup_tree.c */
++struct _l_node *_l_alloc(struct in_addr, char *);
++char *_l_get(struct in_addr);
++int _l_insert(struct _l_node * new);
++
++/* Form msg.c */
++void err(char *fmt, ...);
++void msg(int v, int attr, int fg, char *fmt, ...);
++void sorry(char * func, char * desc);
++
++/* From quit.c */
++void fault(char * func, char * desc);
++void suicide(char * func, char * fmt, ...);
++void print_statistics();
++void cleanup();
++void exit_signal(int sig_type);
++
++/* From tcpick.c */
++void signal_setup(int sig, void (*handler)(  ));
++
++/* From time.c */
++char * time_ascii(char * ret);
++
++/* From timer.c */
++void set_timer();
++void check_expired();
++void sigalrm_callback(int sig_type);
++
++/* From tracker.c */
++int status_switch(struct CONN * prev, enum STATUS status);
++int newconn( struct CONN * prev_ring );
++int rmconn( struct CONN * prev_ring );
++int free_desc( struct HOST_DESC * desc, int freedescfilename );
++
++/* From verify.c */
++int
++verify();
++
++/* From write.c */
++char *
++avail_filename(struct CONN * conn_ptr,
++               enum PART side, char * ext);
++
++void
++open_file(struct CONN * conn_ptr,
++          struct HOST_DESC * desc);
++
++int
++flowflush(struct CONN * conn_ptr,
++          struct HOST_DESC * desc,
++          u_char * buf,
++          int buflen);
++
++int
++out_flavour(enum FLAVOUR flavour,
++            FILE * out,
++            u_char * buf,
++            int buflen);
+--- a/src/loop.c
++++ b/src/loop.c
+@@ -95,8 +95,7 @@ got_packet (u_char * useless,
+ #endif /* TCPICK_DEBUG */
+               if( flags.header > 0 )
+-                      display_header( stdout, ippacket, tcppacket, 
+-                                      payload_len );
++                      display_header(stdout);
+               
+               verify(); /* call the core to manage the packet */
+--- a/src/display.c
++++ b/src/display.c
+@@ -297,7 +297,7 @@ out_x (FILE * out, u_char * buf, int buf
+                                       color( c_NONPRINT, out, pos % 2 ? "%2.2x " : "%2.2x", *( buf + pos ) );
+                       else
+                               /* hex space fill */
+-                              fprintf(out, pos % 2 ? "   " : "  ", *( buf + pos ) );
++                              fprintf(out, pos % 2 ? "   " : "  ");
+                       pos++;
+               } while ( pos % 16 );
+               
+--- a/src/tcpick.c
++++ b/src/tcpick.c
+@@ -50,10 +50,10 @@
+ #include "tcpick.h"
+ #include "globals.h"
+-char *errbuf[PCAP_ERRBUF_SIZE];
++char errbuf[PCAP_ERRBUF_SIZE];
+ struct bpf_program filter_compiled;
+ bpf_u_int32 netp; /* ip */
+-bpf_u_int32 maskp; /* subnet mask */
++bpf_u_int32 maskp = PCAP_NETMASK_UNKNOWN; /* subnet mask */
+ struct in_addr addr;
+ char *other_args = NULL;
+ pcap_t *descr;
+@@ -238,7 +238,7 @@ int main(int argc, char **argv)
+                                   &filter_compiled,
+                                   filter, 
+                                   0, 
+-                                  (int)net 
++                                  maskp
+                             ) == -1) )
+                       err("error compiling filter \"%s\"",filter);
+--- a/src/time.c
++++ b/src/time.c
+@@ -42,7 +42,7 @@ char * time_ascii(char * ret)
+   tzp = (struct timezone * ) S_malloc( sizeof(struct timezone) );
+   memset(tp,  0, sizeof(struct timeval));
+-  memset(tzp, 0, sizeof(struct timeval));
++  memset(tzp, 0, sizeof(struct timezone));
+   
+   if(gettimeofday(tp, tzp)) {
+@@ -58,7 +58,7 @@ char * time_ascii(char * ret)
+                         brokentime->tm_hour,
+                         brokentime->tm_min,
+                         brokentime->tm_sec,
+-                        tp->tv_usec
++                        (int)tp->tv_usec
+                         );
+                 break;
+@@ -79,7 +79,7 @@ char * time_ascii(char * ret)
+                         brokentime->tm_hour,
+                         brokentime->tm_min,
+                         brokentime->tm_sec,
+-                        tp->tv_usec
++                        (int)tp->tv_usec
+                         );
+                 break;
+                 
+@@ -99,7 +99,7 @@ char * time_ascii(char * ret)
+   return ret;
+ retNULL:
+-  sprintf(ret,"");
++  ret[0] = '\0';
+   return NULL;
+ }
+--- a/src/debug.c
++++ b/src/debug.c
+@@ -32,7 +32,7 @@ void
+ print_conn_chain (struct CONN * f)
+ {
+       while (f) {
+-              printf ("%x->",f);
++              printf ("%p->",f);
+               
+               if (f == f->next) {
+                       printf ("inf\n");
+@@ -48,7 +48,7 @@ int
+ print_fragment_chain(struct FRAGMENT * f)
+ {
+       while (f) {
+-              printf ("%x(%i,%i)->",f,f->off,f->len);
++              printf ("%p(%i,%i)->",f,f->off,f->len);
+               if (f == f->next) {
+                       printf ("inf\n");
diff --git a/src/patches/tcpick/003-fix-double-free-error.patch b/src/patches/tcpick/003-fix-double-free-error.patch
new file mode 100644 (file)
index 0000000..c5d934b
--- /dev/null
@@ -0,0 +1,40 @@
+Description: Fix double-free error
+ tcpick try to free twice the pointer to the filename it uses to write
+ the data. This patches fixes that.
+Author: Cedric Delfosse <cedric@debian.org>
+Bug-Debian: http://bugs.debian.org/319864
+Last-Update: 2005-07-26
+Origin: vendor, https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=319864#19
+
+--- a/src/tracker.c
++++ b/src/tracker.c
+@@ -99,8 +99,9 @@ int rmconn( struct CONN * prev_ring )
+       if( curr->next == NULL )
+               last_conn = prev_ring;
+       
+-      free_desc( &(curr->client) );
+-      free_desc( &(curr->server) );
++      free_desc( &(curr->client), 1);
++      if (flags.writer.type == UNIQUE) free_desc( &(curr->server), 0);
++      else free_desc( &(curr->server), 1);
+       S_free( curr );
+       conn = first_conn;
+@@ -124,7 +125,7 @@ int rmconn( struct CONN * prev_ring )
+               count_opened--;
+ }
+-int free_desc( struct HOST_DESC * desc )
++int free_desc( struct HOST_DESC * desc, int freedescfilename )
+ /* frees the host descriptor and closes the file */
+ {
+       struct FRAGMENT * tmp;
+@@ -134,7 +135,7 @@ int free_desc( struct HOST_DESC * desc )
+               if (flags.writer.type == UNIQUE)
+                       desc->oth->file = NULL;
+       }
+-      if( desc->filename ) {
++      if( desc->filename && freedescfilename ) {
+               S_free( desc->filename );
+               desc->filename = NULL;
+       }
diff --git a/src/patches/tcpick/004-fix-man-invocation.patch b/src/patches/tcpick/004-fix-man-invocation.patch
new file mode 100644 (file)
index 0000000..411cfd8
--- /dev/null
@@ -0,0 +1,22 @@
+Description: Fix man invocation
+ Upon startup, tcpick says:
+ .
+ important: `man 1 tcpick' explains all options available
+ .
+ but the man page is in section 8, not 1. This patch fixes that.
+Bug-Debian: http://bugs.debian.org/265067
+Origin: vendor
+Author: Cédric Delfosse <cedric@debian.org>
+Last-Update: 2004-08-18
+
+--- a/src/args.c
++++ b/src/args.c
+@@ -386,7 +386,7 @@ parse_args(int argc, char ** argv)
+       if(flags.versionandquit) {
+               color( c_USAGE, stdout, PACKAGE_STRING "\n"
+                            " Author: " AUTHOR "\n"
+-                           " for other info try `man 1 tcpick', or `%s --help'\n\n"
++                           " for other info try `man tcpick', or `%s --help'\n\n"
+                            TERMS ,TCPICK_NAME);
+               exit( TCPICK_SUCCESS );
+       }
diff --git a/src/patches/tcpick/005-set-timestamp-pcap-header-structure.patch b/src/patches/tcpick/005-set-timestamp-pcap-header-structure.patch
new file mode 100644 (file)
index 0000000..288887b
--- /dev/null
@@ -0,0 +1,77 @@
+Description:Tcpick can display timestamps in the output with the -t and -td switch. It currently computes a timestamp on the fly which has the following consequences
+* Inaccurate timestamps when it is operated in real time mode (-i switch)
+* Nonsense when reassembling off-line captures / when reading pcap files
+Author: Gerard Wagener
+Bug-Ubuntu:https://bugs.launchpad.net/ubuntu/+source/tcpick/+bug/364688
+
+--- a/src/extern.h
++++ b/src/extern.h
+@@ -13,6 +13,7 @@
+ extern struct ip *ippacket;
+ extern struct tcphdr *tcppacket;
+ extern struct udphdr *udppacket;
++extern struct pcap_pkthdr* phdr;
+ extern u_char *payload;
+ extern int payload_len;
+ extern struct FLAGS flags;
+--- a/src/globals.h
++++ b/src/globals.h
+@@ -12,6 +12,7 @@
+ struct ip *ippacket;
+ struct tcphdr *tcppacket;
+ struct udphdr *udppacket;
++struct pcap_pkthdr* phdr = NULL;
+ u_char *payload;
+ int payload_len = 0;
+ struct FLAGS flags;
+--- a/src/loop.c
++++ b/src/loop.c
+@@ -38,6 +38,9 @@
+ { /* FIXME: this function is too long */
++/* Keep track of the original pcap header in order to put correct timestamps */
++    phdr=(struct pcap_pkthdr *)hdr;
++
+       /* check if the flag for checking for expired connections 
+          is turned on */
+       
+--- a/src/time.c
++++ b/src/time.c
+@@ -32,22 +32,16 @@
+ {
+   struct timeval  *tp;
+-  struct timezone *tzp;
+   struct tm * brokentime;
+   if(flags.displaytime == NOTHING_TIME)
+         goto retNULL;
+-  tp  = (struct timeval  * ) S_malloc( sizeof(struct timeval) );
+-  tzp = (struct timezone * ) S_malloc( sizeof(struct timezone) );
++  tp = &phdr->ts;
++  if(!tp) {
+-  memset(tp,  0, sizeof(struct timeval));
+-  memset(tzp, 0, sizeof(struct timezone));
+-  
+-  if(gettimeofday(tp, tzp)) {
+-
+-        perror("gettimeofday returned not 0!");
+-        goto retNULL;
++    perror("No timestamp was available!");
++    goto retNULL;
+   } else {
+         brokentime = localtime(&(tp->tv_sec));
+@@ -93,9 +87,6 @@
+         }
+   }
+-  S_free ( tp ); 
+-  S_free ( tzp );
+-
+   return ret;
+ retNULL:
diff --git a/src/patches/tcpick/006-avoid-implicitly-converted-pointers.patch b/src/patches/tcpick/006-avoid-implicitly-converted-pointers.patch
new file mode 100644 (file)
index 0000000..635ce2c
--- /dev/null
@@ -0,0 +1,107 @@
+Description: Avoid implicitly converted pointers
+ Implicitly converted pointers will cause segfault on architectures where
+ the size of a pointer is greater than the size of an integer, such as
+ ia64.
+Author: dann frazier <dannf@dannf.org>
+Origin: vendor, https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=326927#5
+Bug-Debian: http://bugs.debian.org/326927
+Last-Update: 2005-09-06
+Modified: 2017-09-20
+Author: Erik Kapfer <erik.kapfer@ipfire.org>
+Description: Added avoid-implicitly-converted-pointers.patch again to
+ prevent hunk with set-timestamp-header-structure.patch
+
+diff -Nur tcpick-0.2.1_orig/src/datalink.h tcpick-0.2.1/src/datalink.h
+--- tcpick-0.2.1_orig/src/datalink.h   1970-01-01 01:00:00.000000000 +0100
++++ tcpick-0.2.1/src/datalink.h        2017-09-20 12:43:25.711276936 +0200
+@@ -0,0 +1,29 @@
++/*
++ * datalink.h -- calculates datalink offsets
++ * Part of the tcpick project
++ *
++ * Author: Francesco Stablum <duskdruid @ despammed.com>
++ *
++ * Copyright (C) 2003, 2004  Francesco Stablum
++ * Licensed under the GPL
++ *
++ */
++
++/* 
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License as
++ * published by the Free Software Foundation; either version 2 of the
++ * License, or (at you option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful, but
++ * WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
++ * See the GNU General Public License for more details.
++ * 
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111,
++ * USA.
++ */
++
++char *datalink2str(int dl_id);
+\ Kein Zeilenumbruch am Dateiende.
+diff -Nur tcpick-0.2.1_orig/src/display.c tcpick-0.2.1/src/display.c
+--- tcpick-0.2.1_orig/src/display.c    2017-09-20 12:40:04.803286455 +0200
++++ tcpick-0.2.1/src/display.c 2017-09-20 12:43:54.719275562 +0200
+@@ -28,6 +28,7 @@
+ /* FIXME: most code is duplicated: find a better solution! */
+ #include "tcpick.h"
++#include "lookup.h"
+ #include "extern.h"
+ char * 
+diff -Nur tcpick-0.2.1_orig/src/lookup.h tcpick-0.2.1/src/lookup.h
+--- tcpick-0.2.1_orig/src/lookup.h     2004-12-31 14:53:30.000000000 +0100
++++ tcpick-0.2.1/src/lookup.h  2017-09-20 12:44:38.719273477 +0200
+@@ -26,6 +26,8 @@
+  * USA.
+  */
++#ifndef _LOOKUP_H
++#define _LOOKUP_H
+ struct _l_node /* the node/leaf of the tree */
+ {
+@@ -40,3 +42,9 @@
+       char * name;
+       struct in_addr ip;
+ };
++
++char *lookup(struct in_addr ia);
++struct _l_node *_l_alloc(struct in_addr, char *);
++char *_l_get(struct in_addr);
++
++#endif
+\ Kein Zeilenumbruch am Dateiende.
+diff -Nur tcpick-0.2.1_orig/src/tcpick.c tcpick-0.2.1/src/tcpick.c
+--- tcpick-0.2.1_orig/src/tcpick.c     2017-09-20 12:40:36.319284962 +0200
++++ tcpick-0.2.1/src/tcpick.c  2017-09-20 12:45:07.895272095 +0200
+@@ -49,6 +49,7 @@
+ #include "tcpick.h"
+ #include "globals.h"
++#include "datalink.h"
+ char errbuf[PCAP_ERRBUF_SIZE];
+ struct bpf_program filter_compiled;
+diff -Nur tcpick-0.2.1_orig/src/write.c tcpick-0.2.1/src/write.c
+--- tcpick-0.2.1_orig/src/write.c      2017-09-20 12:39:56.783286835 +0200
++++ tcpick-0.2.1/src/write.c   2017-09-20 12:46:49.223267294 +0200
+@@ -25,8 +25,11 @@
+  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+  */
++#define _GNU_SOURCE
++#include <string.h>
+ #include "tcpick.h"
+ #include "extern.h"
++#include "lookup.h"
+ __inline__ char * 
+ avail_filename(struct CONN * conn_ptr,