mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Allow nsock_iod_get_communication_info() to get latest UDP peer
This commit is contained in:
@@ -638,11 +638,15 @@ static int do_actual_read(struct npool *ms, struct nevent *nse) {
|
||||
err = socket_errno();
|
||||
}
|
||||
else {
|
||||
if (peerlen > 0
|
||||
#ifdef WIN32
|
||||
/* Windows will ignore src_addr and addrlen arguments to recvfrom on TCP
|
||||
* sockets, so peerlen is still sizeof(peer) and peer is junk. Instead,
|
||||
* only set this if it's not already set.
|
||||
*/
|
||||
if (peerlen > 0 && iod->peerlen == 0) {
|
||||
&& (iod->lastproto == IPPROTO_UDP || iod->peerlen == 0)
|
||||
#endif
|
||||
) {
|
||||
assert(peerlen <= sizeof(iod->peer));
|
||||
memcpy(&iod->peer, &peer, peerlen);
|
||||
iod->peerlen = peerlen;
|
||||
|
||||
Reference in New Issue
Block a user