ignore ports of the 127.0.1.1 internal system address

This commit is contained in:
Andreas Steffen 2012-12-09 13:26:34 +01:00
parent 137ea41f45
commit 4037bb5288
1 changed files with 6 additions and 2 deletions

View File

@ -112,6 +112,7 @@ static bool do_netstat(ietf_attr_port_filter_t *attr)
chunk_t line, token;
int n = 0;
bool success = FALSE;
const char system_v4[] = "127.0.1.1";
const char loopback_v4[] = "127.0.0.1";
const char loopback_v6[] = "::1";
@ -187,8 +188,11 @@ static bool do_netstat(ietf_attr_port_filter_t *attr)
}
token.len--;
/* ignore ports of IPv4 and IPv6 loopback interfaces */
if ((token.len == strlen(loopback_v4) &&
/* ignore ports of IPv4 and IPv6 loopback interfaces
and the internal system IPv4 address */
if ((token.len == strlen(system_v4) &&
memeq(system_v4, token.ptr, token.len)) ||
(token.len == strlen(loopback_v4) &&
memeq(loopback_v4, token.ptr, token.len)) ||
(token.len == strlen(loopback_v6) &&
memeq(loopback_v6, token.ptr, token.len)))