X-Git-Url: https://tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fprotocol_misc.c;h=18155e94200606053c02edaa9b5d6a0f7734e039;hp=363c8c3f08e523f811d941c5b3e8d647b09d6654;hb=1401faf608e1c8af0d0754e545b0ec79d2bd5d93;hpb=6f9f6779e6bd1dd7bb795b42dad550863a386ca8;ds=sidebyside diff --git a/src/protocol_misc.c b/src/protocol_misc.c index 363c8c3f..18155e94 100644 --- a/src/protocol_misc.c +++ b/src/protocol_misc.c @@ -17,14 +17,13 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: protocol_misc.c,v 1.1.4.7 2002/09/09 22:33:04 guus Exp $ + $Id: protocol_misc.c,v 1.1.4.9 2003/07/06 23:16:29 guus Exp $ */ #include "config.h" #include #include -#include #include #include #include @@ -37,9 +36,22 @@ #include "protocol.h" #include "meta.h" #include "connection.h" +#include "logger.h" #include "system.h" +/* Status strings */ + +static char (*status_text[]) = { + "Warning", +}; + +/* Error strings */ + +static char (*error_text[]) = { + "Error", +}; + /* Status and error notification routines */ int send_status(connection_t *c, int statusno, char *statusstring) @@ -60,15 +72,13 @@ int status_h(connection_t *c) cp(); if(sscanf(c->buffer, "%*d %d " MAX_STRING, &statusno, statusstring) != 2) { - syslog(LOG_ERR, _("Got bad %s from %s (%s)"), "STATUS", + logger(DEBUG_ALWAYS, LOG_ERR, _("Got bad %s from %s (%s)"), "STATUS", c->name, c->hostname); return -1; } - if(debug_lvl >= DEBUG_STATUS) { - syslog(LOG_NOTICE, _("Status message from %s (%s): %s: %s"), + logger(DEBUG_STATUS, LOG_NOTICE, _("Status message from %s (%s): %s: %s"), c->name, c->hostname, status_text[statusno], statusstring); - } return 0; } @@ -91,15 +101,13 @@ int error_h(connection_t *c) cp(); if(sscanf(c->buffer, "%*d %d " MAX_STRING, &err, errorstring) != 2) { - syslog(LOG_ERR, _("Got bad %s from %s (%s)"), "ERROR", + logger(DEBUG_ALWAYS, LOG_ERR, _("Got bad %s from %s (%s)"), "ERROR", c->name, c->hostname); return -1; } - if(debug_lvl >= DEBUG_ERROR) { - syslog(LOG_NOTICE, _("Error message from %s (%s): %s: %s"), + logger(DEBUG_ERROR, LOG_NOTICE, _("Error message from %s (%s): %s: %s"), c->name, c->hostname, strerror(err), errorstring); - } terminate_connection(c, c->status.active); @@ -185,7 +193,7 @@ int tcppacket_h(connection_t *c) cp(); if(sscanf(c->buffer, "%*d %hd", &len) != 1) { - syslog(LOG_ERR, _("Got bad %s from %s (%s)"), "PACKET", c->name, + logger(DEBUG_ALWAYS, LOG_ERR, _("Got bad %s from %s (%s)"), "PACKET", c->name, c->hostname); return -1; } @@ -196,15 +204,3 @@ int tcppacket_h(connection_t *c) return 0; } - -/* Status strings */ - -char (*status_text[]) = { - "Warning", -}; - -/* Error strings */ - -char (*error_text[]) = { - "Error", -};