1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-19 12: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:
david
2012-06-26 03:23:14 +00:00
parent cb38bebdce
commit 3e50107f23
6 changed files with 48 additions and 12 deletions

View File

@@ -128,8 +128,14 @@ public:
* why a port is in a specific state */
typedef struct port_reason {
reason_t reason_id;
struct sockaddr_storage ip_addr;
union {
struct sockaddr_in in;
struct sockaddr_in6 in6;
struct sockaddr sockaddr;
} ip_addr;
unsigned short ttl;
int set_ip_addr(const struct sockaddr_storage *ss);
} state_reason_t;
/* used to calculate state reason summaries.