diff --git a/meta-oe/recipes-security/nmap/files/nmap-rename-enum-PCAP_SOCKET.patch b/meta-oe/recipes-security/nmap/files/nmap-rename-enum-PCAP_SOCKET.patch
new file mode 100644
index 0000000000..e6bf26ebb6
--- /dev/null
+++ b/meta-oe/recipes-security/nmap/files/nmap-rename-enum-PCAP_SOCKET.patch
@@ -0,0 +1,86 @@
+The enum PCAP_SOCKET conflicts with the one from libpcap 1.10.6 and fails to
+compile:
+
+In file included from /path_to/tmp-glibc/work/corei7-64-wrs-linux/nmap/7.80/recipe-sysroot/usr/include/pcap/pcap.h:130,
+                 from /path_to/tmp-glibc/work/corei7-64-wrs-linux/nmap/7.80/recipe-sysroot/usr/include/pcap.h:43,
+                 from tcpip.h:140,
+                 from nse_nsock.cc:4:
+nse_nsock.cc:36:3: error: expected identifier before 'int'
+   36 |   PCAP_SOCKET = lua_upvalueindex(3), /* pcap socket metatable */
+      |   ^~~~~~~~~~~
+nse_nsock.cc:36:3: error: expected '}' before 'int'
+nse_nsock.cc:33:6: note: to match this '{'
+   33 | enum {
+      |      ^
+nse_nsock.cc:36:15: error: expected unqualified-id before '=' token
+   36 |   PCAP_SOCKET = lua_upvalueindex(3), /* pcap socket metatable */
+      |               ^
+nse_nsock.cc:40:1: error: expected declaration before '}' token
+   40 | };
+      | ^
+
+The enum PCAP_SOCKET is removed in nmap later version. But the removal commit
+involves extra logic change, so just rename the enum PCAP_SOCKET to
+NM_PCAP_SOCKET to make it work with libpcap 1.10.6.
+
+Upstream-Status: Inappropriate [local fix to work with libpcap 1.10.6]
+
+Signed-off-by: Kai Kang <kai.kang@windriver.com>
+---
+ nse_nsock.cc | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/nse_nsock.cc b/nse_nsock.cc
+index df98666..9cecac6 100644
+--- a/nse_nsock.cc
++++ b/nse_nsock.cc
+@@ -33,7 +33,7 @@
+ enum {
+   NSOCK_POOL = lua_upvalueindex(1),
+   NSOCK_SOCKET = lua_upvalueindex(2), /* nsock socket metatable */
+-  PCAP_SOCKET = lua_upvalueindex(3), /* pcap socket metatable */
++  NM_PCAP_SOCKET = lua_upvalueindex(3), /* pcap socket metatable */
+   THREAD_SOCKETS = lua_upvalueindex(4), /* <Thread, Table of Sockets (keys)> */
+   CONNECT_WAITING = lua_upvalueindex(5), /* Threads waiting to lock */
+   KEY_PCAP = lua_upvalueindex(6) /* Keys to pcap sockets */
+@@ -959,7 +959,7 @@ static int nsock_gc (lua_State *L)
+ }
+ 
+ 
+-/****************** PCAP_SOCKET ***********************************************/
++/****************** NM_PCAP_SOCKET ***********************************************/
+ 
+ static void dnet_to_pcap_device_name (lua_State *L, const char *device)
+ {
+@@ -1026,7 +1026,7 @@ static int l_pcap_open (lua_State *L)
+       nsock_iod_delete(*nsiod, NSOCK_PENDING_ERROR);
+       luaL_error(L, "can't open pcap reader on %s", device);
+     }
+-    lua_pushvalue(L, PCAP_SOCKET);
++    lua_pushvalue(L, NM_PCAP_SOCKET);
+     lua_setmetatable(L, -2);
+     lua_pushvalue(L, 7); /* the pcap socket key */
+     lua_pushvalue(L, -2); /* the pcap socket nsiod */
+@@ -1134,7 +1134,7 @@ LUALIB_API int luaopen_nsock (lua_State *L)
+   /* library upvalues */
+   nsock_pool nsp = new_pool(L); /* NSOCK_POOL */
+   lua_newtable(L); /* NSOCK_SOCKET */
+-  lua_newtable(L); /* PCAP_SOCKET */
++  lua_newtable(L); /* NM_PCAP_SOCKET */
+   nseU_weaktable(L, 0, MAX_PARALLELISM, "k"); /* THREAD_SOCKETS */
+   nseU_weaktable(L, 0, 1000, "k"); /* CONNECT_WAITING */
+   nseU_weaktable(L, 0, 0, "v"); /* KEY_PCAP */
+@@ -1154,11 +1154,11 @@ LUALIB_API int luaopen_nsock (lua_State *L)
+   lua_pop(L, 1); /* NSOCK_SOCKET */
+ 
+   /* Create the nsock pcap metatable */
+-  lua_pushvalue(L, top+3); /* PCAP_SOCKET */
++  lua_pushvalue(L, top+3); /* NM_PCAP_SOCKET */
+   for (i = top+1; i <= top+nupvals; i++) lua_pushvalue(L, i);
+   lua_pushcclosure(L, pcap_gc, nupvals);
+   lua_setfield(L, top+3, "__gc");
+-  lua_pop(L, 1); /* PCAP_SOCKET */
++  lua_pop(L, 1); /* NM_PCAP_SOCKET */
+ 
+ #if HAVE_OPENSSL
+   /* Set up the SSL certificate userdata code in nse_ssl_cert.cc. */
diff --git a/meta-oe/recipes-security/nmap/nmap_7.80.bb b/meta-oe/recipes-security/nmap/nmap_7.80.bb
index f9fe82a91d..18b1a50246 100644
--- a/meta-oe/recipes-security/nmap/nmap_7.80.bb
+++ b/meta-oe/recipes-security/nmap/nmap_7.80.bb
@@ -12,6 +12,7 @@ SRC_URI = "http://nmap.org/dist/${BP}.tar.bz2 \
            file://0002-Fix-building-with-libc.patch \
            file://0001-Make-ndiff-support-python3.patch \
            file://0001-configure.ac-make-ndiff-depend-on-python3.patch \
+           file://nmap-rename-enum-PCAP_SOCKET.patch \
            "
 
 SRC_URI[md5sum] = "d37b75b06d1d40f27b76d60db420a1f5"
