diff --git a/net-libs/libpcap/libpcap-1.10.4.recipe b/net-libs/libpcap/libpcap-1.10.4.recipe index 3de6bb2ea..54a81e494 100644 --- a/net-libs/libpcap/libpcap-1.10.4.recipe +++ b/net-libs/libpcap/libpcap-1.10.4.recipe @@ -22,10 +22,10 @@ COPYRIGHT="1988-1998 The Regents of the University of California 2009 Felix Obenhuber 2014 Michal Labedzki for Tieto Corporation" LICENSE="BSD (3-clause)" -REVISION="1" +REVISION="2" SOURCE_URI="http://www.tcpdump.org/release/libpcap-$portVersion.tar.gz" CHECKSUM_SHA256="ed19a0383fad72e3ad435fd239d7cd80d64916b87269550159d20e47160ebe5f" - +PATCHES+="libpcap-$portVersion.patchset" if [ $effectiveTargetArchitecture = x86_gcc2 ]; then PATCHES+=" libpcap-$portVersion.gcc2.patchset diff --git a/net-libs/libpcap/patches/libpcap-1.10.4.patchset b/net-libs/libpcap/patches/libpcap-1.10.4.patchset new file mode 100644 index 000000000..951b4c02b --- /dev/null +++ b/net-libs/libpcap/patches/libpcap-1.10.4.patchset @@ -0,0 +1,51 @@ +From e025ba1728337329298f54cb2cca4ebb0f931948 Mon Sep 17 00:00:00 2001 +From: Jerome Duval +Date: Sat, 17 Feb 2024 17:26:58 +0100 +Subject: libpcap: switch to DLT_RAW for loop and tunnel devices + +backported to 1.10 from upstream 1.11 + +diff --git a/pcap-haiku.cpp b/pcap-haiku.cpp +index 8ae9119..2afca60 100644 +--- a/pcap-haiku.cpp ++++ b/pcap-haiku.cpp +@@ -189,8 +189,6 @@ pcap_activate_haiku(pcap_t *handle) + } + + handle->offset = 0; +- handle->linktype = DLT_EN10MB; +- // TODO: check interface type! + + return 0; + } +@@ -240,6 +238,16 @@ pcap_create_interface(const char *device, char *errorBuffer) + return NULL; + } + ++ // get address ++ if (ioctl(socket, SIOCGIFADDR, &request, sizeof(struct ifreq)) < 0) { ++ snprintf(errorBuffer, PCAP_ERRBUF_SIZE, "Cannot get address: %s\n", ++ strerror(errno)); ++ close(socket); ++ return NULL; ++ } ++ ++ uint8 sdl_type = ((sockaddr_dl&)request.ifr_addr).sdl_type; ++ + // start monitoring + if (ioctl(socket, SIOCSPACKETCAP, &request, sizeof(struct ifreq)) < 0) { + snprintf(errorBuffer, PCAP_ERRBUF_SIZE, "Cannot start monitoring: %s\n", +@@ -261,6 +269,10 @@ pcap_create_interface(const char *device, char *errorBuffer) + + handle->selectable_fd = socket; + handle->fd = socket; ++#ifndef IFT_TUNNEL ++#define IFT_TUNNEL IFT_TUN ++#endif ++ handle->linktype = (sdl_type == IFT_LOOP || sdl_type == IFT_TUNNEL) ? DLT_RAW : DLT_EN10MB; + + handle->activate_op = pcap_activate_haiku; + +-- +2.42.1 +