On Wed, 05 Jun 2024 19:48:43 +0100,
Stuart Henderson <s...@spacehopper.org> wrote:
> 
> just skimmed through it quickly;

Thanks!

> 
> - is AUTORECONF needed or is the default ok?
>

Yet, default is ok, drop.

> - if ${COMPILER_LIBCXX} is used you should set COMPILER, usually with
> base-clang ports-gcc, or maybe base-clang ports-gcc base-gcc (base-gcc
> is only used for m88k). key thing being that archs which have gcc 4 in
> base generally need ports-gcc for building C++ software in ports so
> that we only use a single libstdc++ across the tree (otherwise there
> are conflicts)

I doubt that that it can be build by gcc4, so, keeps base-clang ports-gcc

> - probably worth doing a test build with "COMPILER=ports-gcc" to
> make that it doesn't need any changes to build with ports g++ (sometimes
> we need to set -std)
>

passed

> - license is now GPLv3
>

thanks, I've missed that.

Here an updated diff:

diff --git net/tcpflow/Makefile net/tcpflow/Makefile
index 9601500d65f..4397d587ece 100644
--- net/tcpflow/Makefile
+++ net/tcpflow/Makefile
@@ -1,17 +1,31 @@
-COMMENT=       tool for capturing data from TCP connections
+COMMENT=               tool for capturing data from TCP connections
 
-DISTNAME=      tcpflow-0.21
-REVISION=      2
-CATEGORIES=    net
-SITES=         http://www.circlemud.org/pub/jelson/tcpflow/
+V=                     1.6.1
+DISTNAME=              tcpflow-${V}
+CATEGORIES=            net
 
-HOMEPAGE=       http://www.circlemud.org/~jelson/software/tcpflow/
+SITES=                 
https://github.com/simsong/tcpflow/releases/download/tcpflow-${V}/
 
-# GPLv2
-PERMIT_PACKAGE=        Yes
+HOMEPAGE=              https://github.com/simsong/tcpflow
 
-WANTLIB=               c pcap 
+MAINTAINER=            Kirill A. Korinsky <kir...@korins.ky>
 
-CONFIGURE_STYLE=        gnu
+# GPLv3
+PERMIT_PACKAGE=                Yes
+
+WANTLIB += ${COMPILER_LIBCXX} c crypto m pcap sqlite3 ssl z
+
+COMPILER=              base-clang ports-gcc
+
+LIB_DEPENDS=           databases/sqlite3
+
+# a test for cairo has a side effect which brokes pcap test
+# when it can't find cairo, so, disable it.
+CONFIGURE_ARGS=                --enable-cairo=false
+
+AUTOCONF_VERSION=      2.71
+AUTOMAKE_VERSION=      1.16
+
+CONFIGURE_STYLE=       autoreconf
 
 .include <bsd.port.mk>
diff --git net/tcpflow/distinfo net/tcpflow/distinfo
index 50bb3b39178..9a4e2edfe75 100644
--- net/tcpflow/distinfo
+++ net/tcpflow/distinfo
@@ -1,2 +1,2 @@
-SHA256 (tcpflow-0.21.tar.gz) = FpKL2XIcDeaFtmNl0yC81SqXpO3w4Qh2VK2Ns3nRlGk=
-SIZE (tcpflow-0.21.tar.gz) = 79369
+SHA256 (tcpflow-1.6.1.tar.gz) = Q2+TsRQb4Kvlk3EJRzB9j5ESmlNTw6jDwp4roDVeFx4=
+SIZE (tcpflow-1.6.1.tar.gz) = 450511
diff --git net/tcpflow/patches/patch-configure_ac 
net/tcpflow/patches/patch-configure_ac
new file mode 100644
index 00000000000..a9e99810a6d
--- /dev/null
+++ net/tcpflow/patches/patch-configure_ac
@@ -0,0 +1,40 @@
+Index: configure.ac
+--- configure.ac.orig
++++ configure.ac
+@@ -490,36 +490,6 @@ AC_CHECK_TYPES([sa_family_t], [], [],
+ ]]
+ )
+ 
+-################################################################
+-# Plugin scan_python.cpp requires header "Python.h"
+-# If the header is not present => Disable the source code of the plugin
+-#
+-AC_CHECK_HEADERS(python2.7/Python.h)  # ==> #define HAVE_PYTHON2_7_PYTHON_H
+-AC_CHECK_LIB(python2.7,Py_Initialize,,[
+-  AC_MSG_WARN([
+-*** Cannot find python library.
+-*** Please install python-devel to enable scanner python.
+-  ])
+-  Fmissing_library="$Fmissing_library python-devel "      # Validated on 
Fedora 25
+-  Umissing_library="$Umissing_library libpython2.7-dev"   # Should be OK: 
https://packages.ubuntu.com/yakkety/libpython2.7-dev
+-  Mmissing_library="$Mmissing_library python27"           # Not sure: 
https://github.com/macports/macports-ports/blob/master/lang/python27/Portfile
+-])
+-
+-################################################################
+-# Plugin scanner_python.cpp requires header "Python.h"
+-# If the header is not present => Disable the source code of the plugin
+-#
+-AC_CHECK_HEADERS(python2.7/Python.h)  # ==> #define HAVE_PYTHON2_7_PYTHON_H
+-AC_CHECK_LIB(python2.7,Py_Initialize,,[
+-  AC_MSG_WARN([
+-*** Cannot find python library.
+-*** Please install python-devel to enable scanner python.
+-  ])
+-  Fmissing_library="$Fmissing_library python-devel "      # Validated on 
Fedora 25
+-  Umissing_library="$Umissing_library libpython2.7-dev"   # Should be OK: 
https://packages.ubuntu.com/yakkety/libpython2.7-dev
+-  Mmissing_library="$Mmissing_library python27"           # Not sure: 
https://github.com/macports/macports-ports/blob/master/lang/python27/Portfile
+-])
+-
+ ############## drop optimization flags if requested ################
+ 
+ # Should we disable optimization?
diff --git net/tcpflow/patches/patch-doc_tcpflow_1_in 
net/tcpflow/patches/patch-doc_tcpflow_1_in
index 03a6daf0bb4..f7e4f8edb3c 100644
--- net/tcpflow/patches/patch-doc_tcpflow_1_in
+++ net/tcpflow/patches/patch-doc_tcpflow_1_in
@@ -1,35 +1,27 @@
---- doc/tcpflow.1.in.orig      Mon Feb 26 15:01:30 2001
-+++ doc/tcpflow.1.in   Mon Aug 11 11:07:02 2003
-@@ -32,7 +32,7 @@ tcpflow \- TCP flow recorder 
- is a program that captures data transmitted as part of TCP connections
- (flows), and stores the data in a way that is convenient for protocol
- analysis or debugging.  A program like
--.IR tcpdump(4)
-+.IR tcpdump(8)
- shows a summary of packets seen on the wire, but usually doesn't store
- the data that's actually being transmitted.  In contrast, tcpflow
- reconstructs the actual data streams and stores each flow in a
-@@ -109,7 +109,7 @@ already be in promiscuous mode for some 
+Index: doc/tcpflow.1.in
+--- doc/tcpflow.1.in.orig
++++ doc/tcpflow.1.in
+@@ -377,7 +377,7 @@ as the root privileges are dropped after opening the f
+ .B \-l \fIroot-only*.pcap\fP\c
+ ).
+ This option has the same behaviour as the
+-.IR tcpdump (1)
++.IR tcpdump (8)
+ option having the same name
+ .B \--relinquish-privileges\fB
+ .
+@@ -386,7 +386,7 @@ option having the same name
  Read from file.  Read packets from \fIfile\fP, which was created using the
  .B \-w
  option of
 -.IR tcpdump (1).
 +.IR tcpdump (8).
- Standard input is used if \fIfile\fP is ``-''.
+ This option may be repeated any number of times. Standard input is used if 
\fIfile\fP is "-".
  Note that for this option to be useful, tcpdump's
  .B \-s
-@@ -132,7 +132,7 @@ The
- specified on the command-line specifies which packets should be
- captured.  Because tcpflow uses the the libpcap library, tcpflow has
- the same powerful filtering language available as programs such as
--.IR tcpdump (1).
-+.IR tcpdump (8).
- .LP
- .B The following part of the man page is excerpted from the tcpdump man page.
- .LP
-@@ -539,4 +539,4 @@ The current version of this software is 
- .I http://www.circlemud.org/~jelson/software/tcpflow
+@@ -642,4 +642,4 @@ An announcement mailing list for this program is at:
+ .I http://groups.google.com/group/tcpflow-users
  .RE
  .SH "SEE ALSO"
--tcpdump(1), nit(4P), bpf(4), pcap(3)
-+tcpdump(8), nit(4P), bpf(4), pcap(3)
+-tcpdump(1), nit(4P), bpf(4), pcap(3), pcap-savefile(5), pcap-filter(7)
++tcpdump(8), nit(4P), bpf(4), pcap(3), pcap-savefile(5), pcap-filter(7)
diff --git net/tcpflow/patches/patch-src_be13_api_bulk_extractor_i_h 
net/tcpflow/patches/patch-src_be13_api_bulk_extractor_i_h
new file mode 100644
index 00000000000..da2b95d3922
--- /dev/null
+++ net/tcpflow/patches/patch-src_be13_api_bulk_extractor_i_h
@@ -0,0 +1,24 @@
+Index: src/be13_api/bulk_extractor_i.h
+--- src/be13_api/bulk_extractor_i.h.orig
++++ src/be13_api/bulk_extractor_i.h
+@@ -296,6 +296,8 @@ namespace be13 {
+  *
+  */
+ class packet_info {
++private:
++    struct timeval _ts;
+ public:
+     // IPv4 header offsets
+     static const size_t ip4_proto_off = 9;
+@@ -325,7 +327,10 @@ class packet_info { (public)
+                 const struct timeval &ts_,const uint8_t *d2,size_t dl2):
+         
pcap_dlt(dlt),pcap_hdr(h),pcap_data(d),ts(ts_),ip_data(d2),ip_datalen(dl2){}
+     packet_info(const int dlt,const struct pcap_pkthdr *h,const u_char *d):
+-        
pcap_dlt(dlt),pcap_hdr(h),pcap_data(d),ts(h->ts),ip_data(d),ip_datalen(h->caplen){}
++        
pcap_dlt(dlt),pcap_hdr(h),pcap_data(d),ts(_ts),ip_data(d),ip_datalen(h->caplen){
++        _ts.tv_sec  = h->ts.tv_sec;
++        _ts.tv_usec = h->ts.tv_usec;
++    }
+ 
+     const int    pcap_dlt;              // data link type; needed by libpcap, 
not provided
+     const struct pcap_pkthdr *pcap_hdr; // provided by libpcap
diff --git net/tcpflow/patches/patch-src_datalink_c 
net/tcpflow/patches/patch-src_datalink_c
deleted file mode 100644
index 179d986ed47..00000000000
--- net/tcpflow/patches/patch-src_datalink_c
+++ /dev/null
@@ -1,39 +0,0 @@
---- src/datalink.c.orig        Fri Mar 29 23:19:03 2002
-+++ src/datalink.c     Wed May 13 10:41:44 2009
-@@ -137,7 +137,26 @@ void dl_ppp(u_char *user, const struct pcap_pkthdr *h,
-   process_ip(p + PPP_HDRLEN, caplen - PPP_HDRLEN);
- }
- 
-+#define       PPP_ETHER_HDRLEN 8
- 
-+void dl_ppp_ether(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
-+{
-+  u_int caplen = h->caplen;
-+  u_int length = h->len;
-+
-+  if (length != caplen) {
-+    DEBUG(6) ("warning: only captured %d bytes of %d byte PPPoE frame",
-+        caplen, length);
-+  }
-+
-+  if (caplen < PPP_ETHER_HDRLEN) {
-+    DEBUG(6) ("warning: received incomplete PPP frame");
-+    return;
-+  }
-+
-+  process_ip(p + PPP_ETHER_HDRLEN, caplen - PPP_ETHER_HDRLEN);
-+}
-+
- /* DLT_RAW: just a raw IP packet, no encapsulation or link-layer
-  * headers.  Used for PPP connections under some OSs including Linux
-  * and IRIX. */
-@@ -188,7 +207,9 @@ pcap_handler find_handler(int datalink_type, char *dev
- #endif
-     { dl_ethernet, DLT_EN10MB },
-     { dl_ethernet, DLT_IEEE802 },
-+    { dl_null, DLT_LOOP },
-     { dl_ppp, DLT_PPP },
-+    { dl_ppp_ether, DLT_PPP_ETHER },
- #ifdef DLT_LINUX_SLL
-     { dl_linux_sll, DLT_LINUX_SLL },
- #endif
diff --git net/tcpflow/patches/patch-src_datalink_cpp 
net/tcpflow/patches/patch-src_datalink_cpp
new file mode 100644
index 00000000000..ba83ecee414
--- /dev/null
+++ net/tcpflow/patches/patch-src_datalink_cpp
@@ -0,0 +1,52 @@
+Index: src/datalink.cpp
+--- src/datalink.cpp.orig
++++ src/datalink.cpp
+@@ -71,6 +71,29 @@ void dl_null(u_char *user, const struct pcap_pkthdr *h
+ #pragma GCC diagnostic warning "-Wcast-align"
+ 
+ static uint64_t counter=0;
++
++#define       PPP_ETHER_HDRLEN 8
++
++void dl_ppp_ether(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
++{
++  u_int caplen = h->caplen;
++  u_int length = h->len;
++
++  if (length != caplen) {
++    DEBUG(6) ("warning: only captured %d bytes of %d byte PPPoE frame",
++        caplen, length);
++  }
++
++  if (caplen < PPP_ETHER_HDRLEN) {
++    DEBUG(6) ("warning: received incomplete PPP frame");
++    return;
++  }
++
++  struct timeval tv;
++  be13::packet_info 
pi(DLT_PPP_ETHER,h,p,tvshift(tv,h->ts),p+PPP_ETHER_HDRLEN,caplen - 
PPP_ETHER_HDRLEN);
++  be13::plugin::process_packet(pi);
++}
++
+ /* DLT_RAW: just a raw IP packet, no encapsulation or link-layer
+  * headers.  Used for PPP connections under some OSs including Linux
+  * and IRIX. */
+@@ -278,14 +301,18 @@ dlt_handler_t handlers[] = {
+     { dl_raw,     101 },
+     { dl_ethernet, DLT_EN10MB },
+     { dl_ethernet, DLT_IEEE802 },
++    { dl_null,          DLT_LOOP },
+     { dl_ppp,           DLT_PPP },
++    { dl_ppp_ether,     DLT_PPP_ETHER },
+ #ifdef DLT_LINUX_SLL
+     { dl_linux_sll,        DLT_LINUX_SLL },
+ #endif
+ #if defined(USE_WIFI) && !defined(WIN32)
+     { dl_ieee802_11_radio, DLT_IEEE802_11 },
+     { dl_ieee802_11_radio, DLT_IEEE802_11_RADIO },
++#ifdef DLT_PRISM_HEADER
+     { dl_prism,            DLT_PRISM_HEADER},
++#endif
+ #endif
+     { NULL, 0 }
+ };
diff --git net/tcpflow/patches/patch-src_main_c 
net/tcpflow/patches/patch-src_main_c
deleted file mode 100644
index 9da5db91740..00000000000
--- net/tcpflow/patches/patch-src_main_c
+++ /dev/null
@@ -1,11 +0,0 @@
---- src/main.c.orig    Thu Aug  7 00:35:24 2003
-+++ src/main.c Mon Aug 11 11:04:03 2003
-@@ -80,7 +80,7 @@ void print_usage(char *progname)
-   fprintf(stderr, "%s version %s by Jeremy Elson <jel...@circlemud.org>\n\n",
-                PACKAGE, VERSION);
-   fprintf(stderr, "usage: %s [-chpsv] [-b max_bytes] [-d debug_level] [-f 
max_fds]\n", progname);
--  fprintf(stderr, "          [-i iface] [-w file] [expression]\n\n");
-+  fprintf(stderr, "          [-i iface] [-r file] [expression]\n\n");
-   fprintf(stderr, "        -b: max number of bytes per flow to save\n");
-   fprintf(stderr, "        -c: console print only (don't create files)\n");
-   fprintf(stderr, "        -d: debug level; default is %d\n", 
DEFAULT_DEBUG_LEVEL);
diff --git net/tcpflow/patches/patch-src_tcpflow_h 
net/tcpflow/patches/patch-src_tcpflow_h
new file mode 100644
index 00000000000..1b34fa11c67
--- /dev/null
+++ net/tcpflow/patches/patch-src_tcpflow_h
@@ -0,0 +1,16 @@
+Index: src/tcpflow.h
+--- src/tcpflow.h.orig
++++ src/tcpflow.h
+@@ -297,6 +297,12 @@ inline const timeval &tvshift(struct timeval &tv,const
+     return tv;
+ }
+ 
++inline const timeval &tvshift(struct timeval &tv,const struct bpf_timeval 
&tv_)
++{
++    tv.tv_sec  = tv_.tv_sec + datalink_tdelta;
++    tv.tv_usec = tv_.tv_usec;
++    return tv;
++}
+ 
+ 
+ /* util.cpp - utility functions */
diff --git net/tcpflow/patches/patch-src_util_c 
net/tcpflow/patches/patch-src_util_c
deleted file mode 100644
index da879c9f539..00000000000
--- net/tcpflow/patches/patch-src_util_c
+++ /dev/null
@@ -1,20 +0,0 @@
---- src/util.c.orig    Wed Aug  8 12:39:40 2001
-+++ src/util.c Mon Aug 11 11:06:15 2003
-@@ -65,7 +65,7 @@ void *check_malloc(size_t size)
- void init_debug(char *argv[])
- {
-   debug_prefix = MALLOC(char, strlen(argv[0]) + 16);
--  sprintf(debug_prefix, "%s[%d]", argv[0], (int) getpid());
-+  snprintf(debug_prefix, (strlen(argv[0]) +16), "%s[%d]", argv[0], (int) 
getpid());
- }
- 
- 
-@@ -144,7 +144,7 @@ char *flow_filename(flow_t flow)
- 
-   ring_pos = (ring_pos + 1) % RING_SIZE;
- 
--  sprintf(ring_buffer[ring_pos],
-+  snprintf(ring_buffer[ring_pos], sizeof(ring_buffer[ring_pos]),
-         "%03d.%03d.%03d.%03d.%05d-%03d.%03d.%03d.%03d.%05d",
-         (u_int8_t) ((flow.src & 0xff000000) >> 24),
-         (u_int8_t) ((flow.src & 0x00ff0000) >> 16),
diff --git net/tcpflow/patches/patch-src_wifipcap_wifipcap_cpp 
net/tcpflow/patches/patch-src_wifipcap_wifipcap_cpp
new file mode 100644
index 00000000000..ec2b1f9fb48
--- /dev/null
+++ net/tcpflow/patches/patch-src_wifipcap_wifipcap_cpp
@@ -0,0 +1,51 @@
+Index: src/wifipcap/wifipcap.cpp
+--- src/wifipcap/wifipcap.cpp.orig
++++ src/wifipcap/wifipcap.cpp
+@@ -1668,7 +1668,11 @@ void Wifipcap::Init(const char *name, bool live) {
+     }
+ 
+     datalink = pcap_datalink(descr);
+-    if (datalink != DLT_PRISM_HEADER && datalink != DLT_IEEE802_11_RADIO && 
datalink != DLT_IEEE802_11) {
++    if (
++#ifdef DLT_PRISM_HEADER
++        datalink != DLT_PRISM_HEADER &&
++#endif
++        datalink != DLT_IEEE802_11_RADIO && datalink != DLT_IEEE802_11) {
+       if (datalink == DLT_EN10MB) {
+           printf("warning: ethernet datalink type: %s\n",
+                  pcap_datalink_val_to_name(datalink));
+@@ -1692,8 +1696,10 @@ void Wifipcap::handle_packet(WifipcapCallbacks *cbs,in
+ {
+     /* Record start time if we don't have it */
+     if (startTime == TIME_NONE) {
+-      startTime = header->ts;
+-      lastPrintTime = header->ts;
++      startTime.tv_sec = header->ts.tv_sec;
++      startTime.tv_usec = header->ts.tv_usec;
++      lastPrintTime.tv_sec = header->ts.tv_sec;
++      lastPrintTime.tv_usec = header->ts.tv_usec;
+     }
+     /* Print stats if necessary */
+     if (header->ts.tv_sec > lastPrintTime.tv_sec + 
Wifipcap::PRINT_TIME_INTERVAL) {
+@@ -1704,7 +1710,8 @@ void Wifipcap::handle_packet(WifipcapCallbacks *cbs,in
+           fprintf(stderr, "wifipcap: %2d days %2d hours, %10" PRId64 " 
pkts\n", 
+                   days, left, packetsProcessed);
+       }
+-      lastPrintTime = header->ts;
++      lastPrintTime.tv_sec = header->ts.tv_sec;
++      lastPrintTime.tv_usec = header->ts.tv_usec;
+     }
+     packetsProcessed++;
+ 
+@@ -1715,9 +1722,11 @@ void Wifipcap::handle_packet(WifipcapCallbacks *cbs,in
+     cbs->PacketBegin(pkt, packet, header->caplen, header->len);
+     //int frameLen = header->caplen;
+     switch(header_type) {
++#ifdef DLT_PRISM_HEADER
+     case DLT_PRISM_HEADER:
+         pkt.handle_prism(packet,header->caplen);
+         break;
++#endif
+     case DLT_IEEE802_11_RADIO:
+         pkt.handle_radiotap(packet,header->caplen);
+         break;
diff --git net/tcpflow/patches/patch-src_wifipcap_wifipcap_h 
net/tcpflow/patches/patch-src_wifipcap_wifipcap_h
new file mode 100644
index 00000000000..3dbcb866dd8
--- /dev/null
+++ net/tcpflow/patches/patch-src_wifipcap_wifipcap_h
@@ -0,0 +1,12 @@
+Index: src/wifipcap/wifipcap.h
+--- src/wifipcap/wifipcap.h.orig
++++ src/wifipcap/wifipcap.h
+@@ -12,7 +12,7 @@
+ #include <stdint.h>
+ #include <inttypes.h>
+ 
+-#include <pcap/pcap.h>
++#include <pcap.h>
+ #include <netinet/in.h>
+ 
+ #include "arp.h"


-- 
wbr, Kirill

Reply via email to