diff --git a/CHANGES b/CHANGES index 279200c6f4..c20e7b9eb5 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,12 @@ +6.0.0-dev.165 | 2023-03-08 12:07:45 +0100 + + * Revert "Merge branch 'topic/jgras/iosource-offline-fd' of https://github.com/J-Gras/zeek" (Arne Welzel, Corelight) + + This reverts commit 957825441a2ed32421fd9955b1cd9d3cbf561da0, reversing + changes made to c8cdc75f2bf56a369904ad54d9a9d05477fb44a3. + + Caused spurious CI failures in the external testing baselines. See zeek/zeek#2842. + 6.0.0-dev.164 | 2023-03-08 11:05:07 +0100 * Allow offline packet sources to register FDs. (Jan Grashoefer, Corelight) diff --git a/NEWS b/NEWS index 2ef87666d7..cc6929540b 100644 --- a/NEWS +++ b/NEWS @@ -64,10 +64,6 @@ New Functionality Changed Functionality --------------------- -- The selectable file descriptor of PktSrc instances in offline mode are now - registered with the IO manager. Previously, these were ignored to avoid - issues specific to libpcap's file descriptor. - - When ``get_file_handle()`` is invoked for an analyzer that did not register an appropriate callback function, log a warning and return a generic handle value based on the analyzer and connection information. diff --git a/VERSION b/VERSION index bea3514f04..1ac6500648 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -6.0.0-dev.164 +6.0.0-dev.165 diff --git a/src/iosource/PktSrc.cc b/src/iosource/PktSrc.cc index 14a36092ff..c7c42edd68 100644 --- a/src/iosource/PktSrc.cc +++ b/src/iosource/PktSrc.cc @@ -83,11 +83,17 @@ void PktSrc::Opened(const Properties& arg_props) } if ( props.is_live ) + { Info(util::fmt("listening on %s\n", props.path.c_str())); - if ( props.selectable_fd != -1 ) - if ( ! iosource_mgr->RegisterFd(props.selectable_fd, this) ) - reporter->FatalError("Failed to register pktsrc fd with iosource_mgr"); + // We only register the file descriptor if we're in live + // mode because libpcap's file descriptor for trace files + // isn't a reliable way to know whether we actually have + // data to read. + if ( props.selectable_fd != -1 ) + if ( ! iosource_mgr->RegisterFd(props.selectable_fd, this) ) + reporter->FatalError("Failed to register pktsrc fd with iosource_mgr"); + } DBG_LOG(DBG_PKTIO, "Opened source %s", props.path.c_str()); } diff --git a/src/iosource/pcap/Source.cc b/src/iosource/pcap/Source.cc index fd01c19554..4ebd8e77ca 100644 --- a/src/iosource/pcap/Source.cc +++ b/src/iosource/pcap/Source.cc @@ -182,11 +182,10 @@ void PcapSource::OpenOffline() return; } - // We don't register the file descriptor if we're in offline mode, - // because libpcap's file descriptor for trace files isn't a reliable - // way to know whether we actually have data to read. - // See https://github.com/the-tcpdump-group/libpcap/issues/870 - props.selectable_fd = -1; + props.selectable_fd = fileno(pcap_file(pd)); + + if ( props.selectable_fd < 0 ) + InternalError("OS does not support selectable pcap fd"); props.link_type = pcap_datalink(pd); props.is_live = false;