Files
meta-openembedded/meta-oe/recipes-security/nmap/files/0004-libdnet-fix-PF_PACKET-conftest-nested-function.patch
Khem Raj 13bafd2753 nmap: upgrade 7.92 -> 7.99
License-Update: relicensed to NPSL (Nmap Public Source License)

fix bundled libdnet configure and static link

Add a patch fixing the libdnet PF_PACKET conftest, which used a
nested function definition clang rejects, making configure
wrongly conclude there is no Ethernet support.

Clear DISABLE_STATIC so the bundled libdnet libtool build also
produces libdnet.a (nmap links it statically), and serialize
the make since the top-level Makefile does not order the
link after the recursive libdnet build.

Also regenerate an existing patch to apply without fuzz.

Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
2026-06-28 00:59:20 -07:00

39 lines
1.3 KiB
Diff

From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 24 Jun 2026 00:00:00 +0000
Subject: [PATCH] libdnet: fix PF_PACKET conftest nested function
The bundled libdnet-stripped AC_DNET_LINUX_PF_PACKET check used
"int foo() { return ETH_P_ALL; }" as the AC_TRY_COMPILE body, which the
generated configure places inside main(). clang rejects nested function
definitions ("function definition is not allowed here"), so the check
fails and configure aborts with "Ethernet support not found". Use a plain
expression statement that still references ETH_P_ALL. Patch both the macro
source and the shipped configure.
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
--- a/libdnet-stripped/m4/acinclude.m4
+++ b/libdnet-stripped/m4/acinclude.m4
@@ -149,7 +149,7 @@
[AC_MSG_CHECKING(for Linux PF_PACKET sockets)
AC_TRY_COMPILE([#include <netpacket/packet.h>
#include <linux/if_ether.h>],
- [int foo() { return ETH_P_ALL; }],
+ [(void) ETH_P_ALL;],
ac_cv_dnet_linux_pf_packet=yes,
ac_cv_dnet_linux_pf_packet=no)
AC_MSG_RESULT($ac_cv_dnet_linux_pf_packet)
--- a/libdnet-stripped/configure
+++ b/libdnet-stripped/configure
@@ -15219,7 +15219,7 @@
int
main (void)
{
-int foo() { return ETH_P_ALL; }
+(void) ETH_P_ALL;
;
return 0;
}