Don't spam syslog with "inet_ntop(): Address family not supported

by protocol family" when processing requests received from the
UNIX domain socket.

MFC after:	3 days
This commit is contained in:
Ruslan Ermilov 2011-04-20 08:38:25 +00:00
parent 1024547144
commit 81b587f396

View File

@ -1214,7 +1214,8 @@ snmpd_input(struct port_input *pi, struct tport *tport)
/*
* In case of AF_INET{6} peer, do hosts_access(5) check.
*/
if (inet_ntop(pi->peer->sa_family,
if (pi->peer->sa_family != AF_LOCAL &&
inet_ntop(pi->peer->sa_family,
&((const struct sockaddr_in *)(const void *)pi->peer)->sin_addr,
client, sizeof(client)) != NULL) {
request_set(&req, RQ_CLIENT_ADDR, client, 0);
@ -1223,7 +1224,7 @@ snmpd_input(struct port_input *pi, struct tport *tport)
eval_client(&req));
return (-1);
}
} else
} else if (pi->peer->sa_family != AF_LOCAL)
syslog(LOG_ERR, "inet_ntop(): %m");
#endif