/*
netutl.c -- some supporting network utility code
- Copyright (C) 1998-2002 Ivo Timmermans <ivo@o2w.nl>
- 2000-2002 Guus Sliepen <guus@sliepen.eu.org>
+ Copyright (C) 1998-2003 Ivo Timmermans <ivo@o2w.nl>
+ 2000-2003 Guus Sliepen <guus@sliepen.eu.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id: netutl.c,v 1.12.4.44 2002/09/09 22:32:44 guus Exp $
+ $Id: netutl.c,v 1.12.4.47 2003/07/17 15:06:26 guus Exp $
*/
-#include "config.h"
-
-#include <fcntl.h>
-#include <netdb.h>
-#include <netinet/in.h>
-#include <stdio.h>
-#include <stdlib.h>
-#ifdef HAVE_INTTYPES_H
-#include <inttypes.h>
-#endif
-#include <string.h>
-#include <signal.h>
-#include <sys/socket.h>
-#include <syslog.h>
-#include <arpa/inet.h>
-
-#include <utils.h>
-#include <xalloc.h>
-
-#include "errno.h"
-#include "conf.h"
+#include "system.h"
+
#include "net.h"
#include "netutl.h"
-
-#include "system.h"
+#include "logger.h"
+#include "utils.h"
+#include "xalloc.h"
int hostnames = 0;
err = getaddrinfo(address, service, &hint, &ai);
if(err) {
- if(debug_lvl >= DEBUG_ERROR)
- syslog(LOG_WARNING, _("Error looking up %s port %s: %s\n"), address,
+ logger(LOG_WARNING, _("Error looking up %s port %s: %s\n"), address,
service, gai_strerror(err));
- cp_trace();
return NULL;
}
err = getaddrinfo(address, port, &hint, &ai);
if(err || !ai) {
- syslog(LOG_ERR, _("Error looking up %s port %s: %s\n"), address, port,
+ logger(LOG_ERR, _("Error looking up %s port %s: %s\n"), address, port,
gai_strerror(err));
cp_trace();
raise(SIGFPE);
err = getnameinfo(&sa->sa, SALEN(sa->sa), address, sizeof(address), port, sizeof(port), NI_NUMERICHOST | NI_NUMERICSERV);
if(err) {
- syslog(LOG_ERR, _("Error while translating addresses: %s"),
+ logger(LOG_ERR, _("Error while translating addresses: %s"),
gai_strerror(err));
cp_trace();
raise(SIGFPE);
err = getnameinfo(&sa->sa, SALEN(sa->sa), address, sizeof(address), port, sizeof(port),
hostnames ? 0 : (NI_NUMERICHOST | NI_NUMERICSERV));
if(err) {
- syslog(LOG_ERR, _("Error while looking up hostname: %s"),
+ logger(LOG_ERR, _("Error while looking up hostname: %s"),
gai_strerror(err));
}
return memcmp(&a->in6.sin6_port, &b->in6.sin6_port, sizeof(a->in6.sin6_port));
default:
- syslog(LOG_ERR, _("sockaddrcmp() was called with unknown address family %d, exitting!"),
+ logger(LOG_ERR, _("sockaddrcmp() was called with unknown address family %d, exitting!"),
a->sa.sa_family);
cp_trace();
raise(SIGFPE);