From 7744104b74e42bbd0db9788d1af55207a9e5f005 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Mon, 3 Feb 2020 20:51:49 -0800 Subject: [PATCH] nmap: fix compilation with libcxx Missing headers and confusion between std::bind and bind. Signed-off-by: Rosen Penev --- net/nmap/Makefile | 2 +- net/nmap/patches/010-cxx.patch | 80 ++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 net/nmap/patches/010-cxx.patch diff --git a/net/nmap/Makefile b/net/nmap/Makefile index 62a3280c77..898374825c 100644 --- a/net/nmap/Makefile +++ b/net/nmap/Makefile @@ -14,7 +14,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=nmap PKG_VERSION:=7.70 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_MAINTAINER:=Nuno Goncalves PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 diff --git a/net/nmap/patches/010-cxx.patch b/net/nmap/patches/010-cxx.patch new file mode 100644 index 0000000000..8007b60ed9 --- /dev/null +++ b/net/nmap/patches/010-cxx.patch @@ -0,0 +1,80 @@ +--- a/nmap_error.cc ++++ b/nmap_error.cc +@@ -135,6 +135,7 @@ + #include "xml.h" + + #include ++#include + + extern NmapOps o; + +--- a/nping/EchoServer.cc ++++ b/nping/EchoServer.cc +@@ -131,6 +131,7 @@ + #include "EchoServer.h" + #include "EchoHeader.h" + #include "NEPContext.h" ++#include + #include + #include "nsock.h" + #include "output.h" +@@ -281,12 +282,12 @@ int EchoServer::nep_listen_socket(){ + server_addr6.sin6_len = sizeof(struct sockaddr_in6); + #endif + /* Bind to local address and the specified port */ +- if( bind(master_sd, (struct sockaddr *)&server_addr6, sizeof(server_addr6)) != 0 ){ ++ if( ::bind(master_sd, (struct sockaddr *)&server_addr6, sizeof(server_addr6)) != 0 ){ + nping_warning(QT_3, "Failed to bind to source address %s. Trying to bind to port %d...", IPtoa(server_addr6.sin6_addr), port); + /* If the bind failed for the supplied address, just try again with in6addr_any */ + if( o.spoofSource() ){ + server_addr6.sin6_addr = in6addr_any; +- if( bind(master_sd, (struct sockaddr *)&server_addr6, sizeof(server_addr6)) != 0 ){ ++ if( ::bind(master_sd, (struct sockaddr *)&server_addr6, sizeof(server_addr6)) != 0 ){ + nping_fatal(QT_3, "Could not bind to port %d (%s).", port, strerror(errno)); + }else{ + nping_print(VB_1, "Server bound to port %d", port); +@@ -319,12 +320,12 @@ int EchoServer::nep_listen_socket(){ + #endif + + /* Bind to local address and the specified port */ +- if( bind(master_sd, (struct sockaddr *)&server_addr4, sizeof(server_addr4)) != 0 ){ ++ if( ::bind(master_sd, (struct sockaddr *)&server_addr4, sizeof(server_addr4)) != 0 ){ + nping_warning(QT_3, "Failed to bind to source address %s. Trying to bind to port %d...", IPtoa(server_addr4.sin_addr), port); + /* If the bind failed for the supplied address, just try again with in6addr_any */ + if( o.spoofSource() ){ + server_addr4.sin_addr.s_addr=INADDR_ANY; +- if( bind(master_sd, (struct sockaddr *)&server_addr4, sizeof(server_addr4)) != 0 ){ ++ if( ::bind(master_sd, (struct sockaddr *)&server_addr4, sizeof(server_addr4)) != 0 ){ + nping_fatal(QT_3, "Could not bind to port %d (%s).", port, strerror(errno)); + }else{ + nping_print(VB_1, "Server bound to port %d", port); +--- a/osscan.cc ++++ b/osscan.cc +@@ -151,6 +151,7 @@ + #endif + + #include ++#include + #include + #include + +--- a/osscan2.cc ++++ b/osscan2.cc +@@ -145,6 +145,7 @@ + + #include "struct_ip.h" + ++#include + #include + #include + +--- a/service_scan.cc ++++ b/service_scan.cc +@@ -173,6 +173,7 @@ + #endif + + #include ++#include + #include + + extern NmapOps o;