mirror of
https://github.com/nmap/nmap.git
synced 2026-01-02 04:49:02 +00:00
Use less memory for ip_addr in port_reason.
This was a sockaddr_storage, which is 128 bytes. This is a lot for a structure that is part of Port. It is now a union of sockaddr_in and sockaddr_in6, which is 28 bytes. A new set_ip_addr method sets the union from a sockaddr_storage, where plain assignment was used before. The sockaddr_storage was introduced in r23778, the first big IPv6 merge.
This commit is contained in:
@@ -928,9 +928,9 @@ int PortList::setStateReason(u16 portno, u8 proto, reason_t reason, u8 ttl,
|
||||
/* set new reason and increment its count */
|
||||
answer->reason.reason_id = reason;
|
||||
if (ip_addr == NULL)
|
||||
answer->reason.ip_addr.ss_family = AF_UNSPEC;
|
||||
answer->reason.ip_addr.sockaddr.sa_family = AF_UNSPEC;
|
||||
else
|
||||
answer->reason.ip_addr = *ip_addr;
|
||||
answer->reason.set_ip_addr(ip_addr);
|
||||
answer->reason.ttl = ttl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user