1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 20:51:30 +00:00

Handle a weird IOCP error for UDP sockets. Fixes #2140

This commit is contained in:
dmiller
2020-10-07 21:56:28 +00:00
parent ee6bc18844
commit c8450d4d0c

View File

@@ -617,7 +617,9 @@ static void call_read_overlapped(struct nevent *nse) {
if (err) { if (err) {
err = socket_errno(); err = socket_errno();
if (errcode_is_failure(err)) { if (errcode_is_failure(err)) {
eov->err = err; // WSARecvFrom with overlapped I/O may generate ERROR_PORT_UNREACHABLE on ICMP error.
// We'll translate that so Nsock-using software doesn't have to know about it.
eov->err = (err == ERROR_PORT_UNREACHABLE ? ECONNREFUSED : err);
/* Send the error to the main loop to be picked up by the appropriate handler */ /* Send the error to the main loop to be picked up by the appropriate handler */
BOOL bRet = PostQueuedCompletionStatus(iinfo->iocp, -1, (ULONG_PTR)nse->iod, (LPOVERLAPPED)eov); BOOL bRet = PostQueuedCompletionStatus(iinfo->iocp, -1, (ULONG_PTR)nse->iod, (LPOVERLAPPED)eov);
if (!bRet) if (!bRet)