ports@,
Here's a diff for net/tcpflow that fixes listening on a loopback interface,
I hope that I'm not too late to fix this in 7.6
It was backported to upstream as well as:
https://github.com/simsong/tcpflow/pull/265
Tested on -current/amd64.
The diff:
Index: Makefile
===================================================================
RCS file: /cvs/ports/net/tcpflow/Makefile,v
retrieving revision 1.31
diff -u -p -r1.31 Makefile
--- Makefile 10 Jun 2024 18:51:59 -0000 1.31
+++ Makefile 18 Sep 2024 22:58:29 -0000
@@ -3,7 +3,7 @@ COMMENT= tool for capturing data from T
V= 1.6.1
DISTNAME= tcpflow-${V}
CATEGORIES= net
-REVISION= 1
+REVISION= 2
SITES= https://github.com/simsong/tcpflow/releases/download/tcpflow-${V}/
Index: patches/patch-src_datalink_cpp
===================================================================
RCS file: /cvs/ports/net/tcpflow/patches/patch-src_datalink_cpp,v
retrieving revision 1.1
diff -u -p -r1.1 patch-src_datalink_cpp
--- patches/patch-src_datalink_cpp 6 Jun 2024 14:04:36 -0000 1.1
+++ patches/patch-src_datalink_cpp 18 Sep 2024 22:58:29 -0000
@@ -1,9 +1,32 @@
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
+@@ -70,7 +70,52 @@ void dl_null(u_char *user, const struct pcap_pkthdr *h
+ }
#pragma GCC diagnostic warning "-Wcast-align"
++#define LOOP_HDRLEN 4
++
++void dl_loop(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 null frame",
++ caplen, length);
++ }
++
++ if (caplen < NULL_HDRLEN) {
++ DEBUG(6) ("warning: received incomplete null frame");
++ return;
++ }
++
++ struct timeval tv;
++ be13::packet_info pi(DLT_LOOP,h,p,tvshift(tv,h->ts),p+LOOP_HDRLEN,caplen - LOOP_HDRLEN);
++ be13::plugin::process_packet(pi);
++}
++
static uint64_t counter=0;
+
+#define PPP_ETHER_HDRLEN 8
@@ -31,11 +54,19 @@ Index: src/datalink.cpp
/* 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 },
+@@ -269,7 +314,8 @@ void dl_linux_sll(u_char *user, const struct pcap_pkth
+
+ /* List of callbacks for each data link type */
+ dlt_handler_t handlers[] = {
+- { dl_null, DLT_NULL },
++ { dl_null, DLT_NULL },
++ { dl_loop, DLT_LOOP },
+ /* Some systems define DLT_RAW as 12, some as 14, and some as 101.
+ * So it is hard-coded here.
+ */
+@@ -279,13 +325,16 @@ dlt_handler_t handlers[] = {
{ 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
--
wbr, Kirill
No comments:
Post a Comment