1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-27 01:49:03 +00:00

Consolidate private IP checking. Add IPv6.

This commit is contained in:
dmiller
2025-01-16 23:00:13 +00:00
parent 3584adf32d
commit 390e0266db
6 changed files with 50 additions and 119 deletions

View File

@@ -165,7 +165,8 @@ int resolve_numeric(const char *ip, unsigned short port,
* <http://www.cymru.com/Documents/bogon-bn-nonagg.txt> for bogon
* netblocks.
*/
int ip_is_reserved(struct in_addr *ip);
int ip_is_reserved(const struct sockaddr_storage *addr);
/* A couple of trivial functions that maintain a cache of IP to MAC
@@ -371,12 +372,6 @@ struct sys_route *getsysroutes(int *howmany, char *errstr, size_t errstrlen);
* Returns 1 if the address is thought to be localhost and 0 otherwise */
int islocalhost(const struct sockaddr_storage *ss);
/* Determines whether the supplied address corresponds to a private,
* non-Internet-routable address. See RFC1918 for details.
* Also checks for link-local addresses per RFC3927.
* Returns 1 if the address is private or 0 otherwise. */
int isipprivate(const struct sockaddr_storage *addr);
/* Takes binary data found in the IP Options field of an IPv4 packet
* and returns a string containing an ASCII description of the options
* found. The function returns a pointer to a static buffer that