From 81b587f396b7a617028b16c968607d46dc703ebf Mon Sep 17 00:00:00 2001 From: Ruslan Ermilov Date: Wed, 20 Apr 2011 08:38:25 +0000 Subject: [PATCH] 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 --- contrib/bsnmp/snmpd/main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/contrib/bsnmp/snmpd/main.c b/contrib/bsnmp/snmpd/main.c index c25fff288864..d8033c7fe4fa 100644 --- a/contrib/bsnmp/snmpd/main.c +++ b/contrib/bsnmp/snmpd/main.c @@ -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