Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2166177

Summary: nmap much slower after bz1596834 got fixed in libpcap [rhel7]
Product: Red Hat Enterprise Linux 7 Reporter: Christian Horn <chorn>
Component: nmapAssignee: Martin Osvald 🛹 <mosvald>
Status: CLOSED WONTFIX QA Contact: František Hrdina <fhrdina>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.9CC: fhrdina, gdelross
Target Milestone: rcKeywords: Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2166178 (view as bug list) Environment:
Last Closed: 2023-09-20 07:30:21 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2166178    
Bug Blocks:    

Description Christian Horn 2023-02-01 04:50:36 UTC
Description of problem:
nmap much slower after bz1596834 got fixed in libpcap

Version-Release number of selected component (if applicable):
libpcap-1.5.3-13.el7_9 (last rhel7 version)
Also seen on rhel8, i.e.
libpcap-1.9.1-5.el8

How reproducible:
always

Steps to Reproduce:
1. install rhel7 with libpcap-1.5.3-12.el7 or later, and nmap (any version)
2. while :; do time nmap -n -r -p 1-65535 127.0.0.1 >/dev/null; done

Actual results:
real    0m6.259s
user    0m1.078s
sys     0m0.879s

real    0m6.254s
user    0m1.098s
sys     0m0.863s

Expected results:
real    0m1.150s
user    0m0.176s
sys     0m0.972s

real    0m1.129s
user    0m0.138s
sys     0m0.990s

Additional info:
- This seems to be a regression after implementing bz1596834.
  I recompiled libpcap-1.5.3-13.el7_9 (last rhel7 libpcap) with this change
  in the specfile:
  < export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
  > export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -DHAVE_TPACKET3"
  With that change, the old (desired, low latency) behaviour is restored.
- rhel8.2/8.4/8.6 are also affected (did not test the other versions), above test 
  case takes ~6sec there.
- rhel9 is not affected, ~1sec for the test case

Comment 6 Christian Horn 2023-02-02 00:43:02 UTC
Right, things seem different here on rhel8.  Recompiling with HAVE_TPACKET3 
does not restore the desired behaviour:

### pristine/unmodified libpcap

[root@rhel8u7a ~]# rpm -q libpcap
libpcap-1.9.1-5.el8.x86_64
[root@rhel8u7a ~]# while :; do time nmap -n -r -p 1-65535 127.0.0.1 >/dev/null; done

real    0m6.179s
user    0m1.037s
sys     0m0.527s

real    0m6.156s
user    0m0.990s
sys     0m0.558s

### Installing custom compiled libpcap

[root@rhel8u7a ~]# rpm -e --nodeps libpcap
[root@rhel8u7a ~]# rpm -i /root/rpmbuild/RPMS/x86_64/libpcap-1.9.1-5.el8_HAVE_TPACKET3.x86_64.rpm
[root@rhel8u7a ~]# while :; do time nmap -n -r -p 1-65535 127.0.0.1 >/dev/null; done

real    0m6.084s
user    0m0.967s
sys     0m0.513s

real    0m6.182s
user    0m1.024s
sys     0m0.532s

[root@rhel8u7a ~]# diff /root/rpmbuild/SPECS/libpcap.spec.org /root/rpmbuild/SPECS/libpcap.spec
4c4
< Release:  5%{?dist}
---
> Release:  5%{?dist}_HAVE_TPACKET3
60c60
< export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
---
> export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -DHAVE_TPACKET3"
[root@rhel8u7a ~]#

Comment 7 Christian Horn 2023-02-28 00:23:14 UTC
On rhel8, this issue was found due to 2 commits missing from nmap:
https://github.com/nmap/nmap/commit/e48361523b18596c023f565053e56d934fff70bd
https://github.com/nmap/nmap/commit/7e644b391ea16f74dd57f5865be545d514de540d
(details: https://bugzilla.redhat.com/show_bug.cgi?id=2166178#c7 )

Changing component to nmap, assuming this also applies here.

At the moment, it looks like we did not get reports for this issue with
high enough criticality to warrant z-stream fixes, so this one might
stay unfixed in the rhel7 stream.

Comment 10 Martin Osvald 🛹 2023-09-20 07:30:21 UTC
Given the current stage of RHEL7 and the higher possibility of introducing regression, I am closing this as WONTFIX.

Comment 11 Red Hat Bugzilla 2024-01-19 04:25:14 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 120 days