Wednesday, June 05, 2024

Re: [update] net/tcpflow to 1.6.1; taking maintainer

just skimmed through it quickly;

- is AUTORECONF needed or is the default ok?

- 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)

- 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)

- license is now GPLv3

On 2024/06/05 16:53, Kirill A. Korinsky wrote:
> ports@,
>
> Here an update for net/tcpflow to the last version. It was quite outdated,
> version 0.21 was released in 2003!
>
> So, it required some work to migrate existed patches, and fix build.
>
> Some patches I was made a while ago and it was already merged by upstream,
> but some of them is new and I'll send it soon.
>
> Anyway, it works and was tested on -current/amd64.
>
> Thus, I also would like to take care of this port.
>
> diff --git net/tcpflow/Makefile net/tcpflow/Makefile
> index 9601500d65f..56c427c3062 100644
> --- net/tcpflow/Makefile
> +++ net/tcpflow/Makefile
> @@ -1,17 +1,30 @@
> -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}/
> +
> +HOMEPAGE= https://github.com/simsong/tcpflow
> +
> +MAINTAINER= Kirill A. Korinsky <kirill@korins.ky>
>
> # GPLv2
> -PERMIT_PACKAGE= Yes
> +PERMIT_PACKAGE= Yes
> +
> +WANTLIB += ${COMPILER_LIBCXX} c crypto m pcap sqlite3 ssl z
> +
> +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
>
> -WANTLIB= c pcap
> +AUTOCONF_VERSION= 2.71
> +AUTOMAKE_VERSION= 1.16
> +AUTORECONF= autoreconf -i
>
> -CONFIGURE_STYLE= gnu
> +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
> -

No comments:

Post a Comment