diff mbox series

[meta-oe,scarthgap,11/11] nmap: rename enum PCAP_SOCKET

Message ID 20260409061904.1694992-12-jinfeng.wang.cn@windriver.com
State New
Headers show
Series Fix multiple CVEs | expand

Commit Message

Wang, Jinfeng (CN) April 9, 2026, 6:19 a.m. UTC
From: Kai Kang <kai.kang@windriver.com>

It fails to build nmap after upgrade libpcap to 1.10.6 which defines the
macro PCAP_SOCKET already. Rename the enum PCAP_SOCKET to NM_PCAP_SOCKET
for nmap to make it work with libpcap 1.10.6.

Signed-off-by: Kai Kang <kai.kang@windriver.com>
Signed-off-by: Jinfeng Wang <jinfeng.wang.cn@windriver.com>
---
 .../files/nmap-rename-enum-PCAP_SOCKET.patch  | 86 +++++++++++++++++++
 meta-oe/recipes-security/nmap/nmap_7.80.bb    |  1 +
 2 files changed, 87 insertions(+)
 create mode 100644 meta-oe/recipes-security/nmap/files/nmap-rename-enum-PCAP_SOCKET.patch

Comments

Gyorgy Sarvari April 9, 2026, 9:40 a.m. UTC | #1
This can become messy, because the layer revisions are not tied to each
other (sure, there are recommendations, but not enforced). Yocto testing
happens usually with a 1-2 weeks old meta-oe, which would mean that this
recipe would be broken until the release of Yocto - also, it would be
the broken when used an older Yocto Scarthgap versions.

What if this patch would be extended, handling both the new and old
versions at the same time? I'm thinking about ifdefs, something like

#ifdef PCAP_SOCKET
  NM_PCAP_SOCKET = lua_upvalueindex(3), /* pcap socket metatable */
#else
  PCAP_SOCKET = lua_upvalueindex(3), /* pcap socket metatable */
#endif

(at all other relevant places also)

That way it wouldn't have to be an optional patch, and it wouldn't break
the recipe - at the worst case it would be just unnecessary (if the
oe-core counterpart is rejected).



On 4/9/26 08:19, Wang, Jinfeng (CN) via lists.openembedded.org wrote:
> From: Kai Kang <kai.kang@windriver.com>
> 
> It fails to build nmap after upgrade libpcap to 1.10.6 which defines the
> macro PCAP_SOCKET already. Rename the enum PCAP_SOCKET to NM_PCAP_SOCKET
> for nmap to make it work with libpcap 1.10.6.
> 
> Signed-off-by: Kai Kang <kai.kang@windriver.com>
> Signed-off-by: Jinfeng Wang <jinfeng.wang.cn@windriver.com>
> ---
>  .../files/nmap-rename-enum-PCAP_SOCKET.patch  | 86 +++++++++++++++++++
>  meta-oe/recipes-security/nmap/nmap_7.80.bb    |  1 +
>  2 files changed, 87 insertions(+)
>  create mode 100644 meta-oe/recipes-security/nmap/files/nmap-rename-enum-PCAP_SOCKET.patch
> 
> 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"
> 
> 
> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#126122): https://lists.openembedded.org/g/openembedded-devel/message/126122
> Mute This Topic: https://lists.openembedded.org/mt/118738443/6084445
> Group Owner: openembedded-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [skandigraun@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Wang, Jinfeng (CN) April 10, 2026, 6:34 a.m. UTC | #2
On 4/9/2026 5:40 PM, Gyorgy Sarvari wrote:
> CAUTION: This email comes from a non Wind River email account!
> Do not click links or open attachments unless you recognize the sender and know the content is safe.
>
> This can become messy, because the layer revisions are not tied to each
> other (sure, there are recommendations, but not enforced). Yocto testing
> happens usually with a 1-2 weeks old meta-oe, which would mean that this
> recipe would be broken until the release of Yocto - also, it would be
> the broken when used an older Yocto Scarthgap versions.
>
> What if this patch would be extended, handling both the new and old
> versions at the same time? I'm thinking about ifdefs, something like
>
> #ifdef PCAP_SOCKET
>    NM_PCAP_SOCKET = lua_upvalueindex(3), /* pcap socket metatable */
> #else
>    PCAP_SOCKET = lua_upvalueindex(3), /* pcap socket metatable */
> #endif
>
> (at all other relevant places also)
>
> That way it wouldn't have to be an optional patch, and it wouldn't break
> the recipe - at the worst case it would be just unnecessary (if the
> oe-core counterpart is rejected).
>
Thanks for the suggestion. I will update the patch and send v2.

Jinfeng

>
> On 4/9/26 08:19, Wang, Jinfeng (CN) via lists.openembedded.org wrote:
>> From: Kai Kang <kai.kang@windriver.com>
>>
>> It fails to build nmap after upgrade libpcap to 1.10.6 which defines the
>> macro PCAP_SOCKET already. Rename the enum PCAP_SOCKET to NM_PCAP_SOCKET
>> for nmap to make it work with libpcap 1.10.6.
>>
>> Signed-off-by: Kai Kang <kai.kang@windriver.com>
>> Signed-off-by: Jinfeng Wang <jinfeng.wang.cn@windriver.com>
>> ---
>>   .../files/nmap-rename-enum-PCAP_SOCKET.patch  | 86 +++++++++++++++++++
>>   meta-oe/recipes-security/nmap/nmap_7.80.bb    |  1 +
>>   2 files changed, 87 insertions(+)
>>   create mode 100644 meta-oe/recipes-security/nmap/files/nmap-rename-enum-PCAP_SOCKET.patch
>>
>> 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"
>>
>>
>>
>> -=-=-=-=-=-=-=-=-=-=-=-
>> Links: You receive all messages sent to this group.
>> View/Reply Online (#126122): https://lists.openembedded.org/g/openembedded-devel/message/126122
>> Mute This Topic: https://lists.openembedded.org/mt/118738443/6084445
>> Group Owner: openembedded-devel+owner@lists.openembedded.org
>> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [skandigraun@gmail.com]
>> -=-=-=-=-=-=-=-=-=-=-=-
>>
diff mbox series

Patch

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"