From: Guus Sliepen Date: Fri, 30 Jun 2000 12:41:06 +0000 (+0000) Subject: - Instead of logging an error when remote end closes the connection, X-Git-Tag: import-tinc-1.1~785^2~886 X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=c5737583c8a5d099a71174e1eb997e0972ae03e9;p=meshlink - Instead of logging an error when remote end closes the connection, we print a nice message if appropiate debug level is set. - If we get ADD_HOSTs or DEL_HOSTs for ourself, then connection lists are really messed up. We restart, and hope our problems go away. --- diff --git a/po/nl.po b/po/nl.po index b432fe19..d24dcccc 100644 --- a/po/nl.po +++ b/po/nl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: tinc 1.0pre3\n" -"POT-Creation-Date: 2000-06-30 13:23+0200\n" +"POT-Creation-Date: 2000-06-30 14:36+0200\n" "PO-Revision-Date: 2000-05-31 20:14+02:00\n" "Last-Translator: Ivo Timmermans \n" "Language-Team: Dutch \n" @@ -178,7 +178,7 @@ msgstr "Aanmaak van metasocket mislukt: %m" msgid "setsockopt: %m" msgstr "setsockopt: %m" -#: src/net.c:424 src/net.c:473 src/net.c:528 +#: src/net.c:424 src/net.c:473 #, c-format msgid "fcntl: %m" msgstr "fcntl: %m" @@ -193,7 +193,7 @@ msgstr "Kan niet aan poort %hd/tcp binden: %m" msgid "listen: %m" msgstr "listen: %m" -#: src/net.c:460 src/net.c:511 +#: src/net.c:460 #, c-format msgid "Creating socket failed: %m" msgstr "Aanmaak socket mislukte: %m" @@ -208,179 +208,194 @@ msgstr "Kan niet aan poort %hd/udp binden: %m" msgid "Trying to connect to %s" msgstr "Poging tot verbinding met %s" -#: src/net.c:521 +#: src/net.c:511 +#, c-format +msgid "Creating socket for %s port %d failed: %m" +msgstr "Aanmaken socket voor %s poort %d mislukt: %m" + +#: src/net.c:522 #, c-format msgid "%s port %hd: %m" msgstr "%s poort %hd: %m" -#: src/net.c:532 +#: src/net.c:529 +#, c-format +msgid "fcntl for %s port %d: %m" +msgstr "fcntl voor %s poort %d: %m" + +#: src/net.c:534 #, c-format msgid "Connected to %s port %hd" msgstr "Verbonden met %s poort %hd" -#: src/net.c:555 +#: src/net.c:557 #, c-format msgid "Could not set up a meta connection to %s" msgstr "Kon geen metaverbinding aangaan met %s" -#: src/net.c:580 +#: src/net.c:582 msgid "No value for my VPN IP given" msgstr "Geen waarde gegeven voor mijn VPN IP adres" -#: src/net.c:601 +#: src/net.c:603 msgid "Unable to set up a listening socket" msgstr "Kon geen luistersocket aanmaken" -#: src/net.c:607 +#: src/net.c:609 msgid "Unable to set up an incoming vpn data socket" msgstr "Kon geen socket maken voor inkomend vpn verkeer" -#: src/net.c:614 +#: src/net.c:616 #, c-format msgid "Ready: listening on port %hd" msgstr "Gereed: luisterend op poort %hd" -#: src/net.c:641 +#: src/net.c:643 #, c-format msgid "Still failed to connect to other, will retry in %d seconds" msgstr "Wederom niet verbonden met de ander, nieuwe poging over %d seconden" -#: src/net.c:679 +#: src/net.c:681 #, c-format msgid "Trying to re-establish outgoing connection in %d seconds" msgstr "Poging tot herstellen van uitgaande verbinding over %d seconden" -#: src/net.c:717 +#: src/net.c:719 msgid "Terminating" msgstr "Beëindigen" -#: src/net.c:731 +#: src/net.c:733 #, c-format msgid "Opening UDP socket to %s" msgstr "Bezig met openen UDP socket naar %s" -#: src/net.c:736 +#: src/net.c:738 #, c-format msgid "Creating UDP socket failed: %m" msgstr "Aanmaak UDP socket mislukte: %m" -#: src/net.c:746 +#: src/net.c:748 #, c-format msgid "Connecting to %s port %d failed: %m" msgstr "Verbinding naar %s poort %d mislukt: %m" -#: src/net.c:754 src/net.c:840 src/net.c:1036 +#: src/net.c:756 src/net.c:843 src/net.c:1041 #, c-format -msgid "This is a bug: %s:%d: %d:%m" -msgstr "Dit is een programmeerfout: %s:%d: %d:%m" +msgid "This is a bug: %s:%d: %d:%m %s (%s)" +msgstr "Dit is een programmeerfout: %s:%d: %d:%m %s (%s)" -#: src/net.c:778 +#: src/net.c:781 #, c-format msgid "Error: getpeername: %m" msgstr "Fout: getpeername: %m" -#: src/net.c:791 +#: src/net.c:794 #, c-format msgid "Connection from %s port %d" msgstr "Verbinding van %s poort %d" -#: src/net.c:845 +#: src/net.c:849 #, c-format -msgid "Incoming data socket error: %s" -msgstr "Fout op socket voor inkomend verkeer: %s" +msgid "Incoming data socket error for %s (%s): %s" +msgstr "Fout op socket voor inkomend verkeer voor %s (%s): %s" -#: src/net.c:853 +#: src/net.c:858 #, c-format -msgid "Receiving packet from %s failed: %m" -msgstr "Ontvangst pakket van %s mislukt: %m" +msgid "Receiving packet from %s (%s) failed: %m" +msgstr "Ontvangst pakket van %s (%s) mislukt: %m" -#: src/net.c:867 +#: src/net.c:872 #, c-format msgid "Got packet from %s (%s) with unknown origin %d.%d.%d.%d?" msgstr "Kreeg pakket van %s (%s) met onbekende herkomst %d.%d.%d.%d?" -#: src/net.c:901 +#: src/net.c:906 #, c-format msgid "Closing connection with %s (%s)" msgstr "Beëindigen verbinding met %s (%s)" -#: src/net.c:945 +#: src/net.c:950 msgid "Trying to re-establish outgoing connection in 5 seconds" msgstr "Poging tot herstellen van uitgaande verbinding over 5 seconden" -#: src/net.c:975 +#: src/net.c:980 #, c-format msgid "%s (%s) didn't respond to PING" msgstr "%s (%s) antwoordde niet op ping" -#: src/net.c:1006 +#: src/net.c:1011 #, c-format msgid "Accepting a new connection failed: %m" msgstr "Aanname van nieuwe verbinding is mislukt: %m" -#: src/net.c:1014 +#: src/net.c:1019 msgid "Closed attempted connection" msgstr "Aangenomen verbinding verbroken" -#: src/net.c:1041 +#: src/net.c:1047 #, c-format -msgid "Metadata socket error: %s" -msgstr "Fout op socket voor metaverkeer: %s" +msgid "Metadata socket error for %s (%s): %s" +msgstr "Fout op socket voor metaverkeer voor %s (%s): %s" -#: src/net.c:1047 +#: src/net.c:1054 msgid "Metadata read buffer overflow!" msgstr "Metadata ontvangstbuffer overloop!" -#: src/net.c:1057 +#: src/net.c:1066 +#, c-format +msgid "Connection closed by %s (%s)" +msgstr "Verbinding verbroken door %s (%s)" + +#: src/net.c:1069 #, c-format -msgid "Metadata socket read error: %m" -msgstr "Fout op socket voor metaverkeer tijdens lezen: %m" +msgid "Metadata socket read error for %s (%s): %m" +msgstr "Fout op socket voor metaverkeer voor %s (%s) tijdens lezen: %m" -#: src/net.c:1081 +#: src/net.c:1094 #, c-format msgid "Got request from %s (%s): %s" msgstr "Ontving verzoek van %s (%s): %s" -#: src/net.c:1087 +#: src/net.c:1100 #, c-format msgid "Unknown request from %s (%s)" msgstr "Onbekend verzoek van %s (%s)" -#: src/net.c:1094 +#: src/net.c:1107 #, c-format msgid "Error while processing request from %s (%s)" msgstr "Fout tijdens afhandelen van verzoek van %s (%s)" -#: src/net.c:1101 +#: src/net.c:1114 #, c-format msgid "Bogus data received from %s (%s)" msgstr "Onzinnige data ontvangen van %s (%s)" -#: src/net.c:1146 +#: src/net.c:1159 #, c-format msgid "Outgoing data socket error for %s (%s): %s" msgstr "Fout op socket voor uitgaand verkeer voor %s (%s): %s" -#: src/net.c:1182 +#: src/net.c:1195 #, c-format msgid "Error while reading from tapdevice: %m" msgstr "Fout tijdens lezen van tap-apparaatbestand tijdens lezen: %m" -#: src/net.c:1192 +#: src/net.c:1205 #, c-format msgid "Non-IP ethernet frame %04x from " msgstr "Niet-IP ethernet pakket %04x van " -#: src/net.c:1200 +#: src/net.c:1213 msgid "Dropping short packet" msgstr "Te kort pakket genegeerd" -#: src/net.c:1239 +#: src/net.c:1252 #, c-format msgid "Error while waiting for input: %m" msgstr "Fout tijdens wachten op invoer: %m" -#: src/net.c:1251 +#: src/net.c:1264 msgid "Unable to reread configuration file, exiting" msgstr "Fout tijdens herlezen configuratie bestand, beëindigen" @@ -418,7 +433,7 @@ msgstr "Verzending TERMREQ naar %s (%s)" #: src/protocol.c:80 src/protocol.c:98 src/protocol.c:116 src/protocol.c:134 #: src/protocol.c:152 src/protocol.c:191 src/protocol.c:209 src/protocol.c:237 #: src/protocol.c:258 src/protocol.c:276 src/protocol.c:319 src/protocol.c:349 -#: src/protocol.c:784 src/protocol.c:887 +#: src/protocol.c:802 src/protocol.c:905 #, c-format msgid "Send failed: %s:%d: %m" msgstr "Verzenden mislukte: %s:%d: %m" @@ -586,128 +601,138 @@ msgstr "Kreeg ongeldige DEL_HOST van %s (%s)" msgid "Got DEL_HOST for %d.%d.%d.%d from %s (%s) which does not exist?" msgstr "Kreeg DEL_HOST voor %d.%d.%d.%d van %s (%s), die niet bestaat?" -#: src/protocol.c:617 +#: src/protocol.c:619 +#, c-format +msgid "Warning: got DEL_HOST from %s (%s) for ourself, restarting" +msgstr "Waarschuwing: kreeg DEL_HOST van %s (%s) voor onszelf, herstart" + +#: src/protocol.c:626 #, c-format msgid "Got DEL_HOST for %s (%s) from %s (%s)" msgstr "Kreeg DEL_HOST voor %s (%s) van %s (%s)" -#: src/protocol.c:635 +#: src/protocol.c:644 #, c-format msgid "Got unauthorized PING from %s (%s)" msgstr "Kreeg niet-geautoriseerde PING van %s (%s)" -#: src/protocol.c:641 +#: src/protocol.c:650 #, c-format msgid "Got PING from %s (%s)" msgstr "Kreeg PING van %s (%s)" -#: src/protocol.c:657 +#: src/protocol.c:666 #, c-format msgid "Got unauthorized PONG from %s (%s)" msgstr "Kreeg niet-geautoriseerde PONG van %s (%s)" -#: src/protocol.c:663 +#: src/protocol.c:672 #, c-format msgid "Got PONG from %s (%s)" msgstr "Kreeg PONG van %s (%s)" -#: src/protocol.c:682 +#: src/protocol.c:691 #, c-format msgid "Got unauthorized ADD_HOST from %s (%s)" msgstr "Kreeg niet-geautoriseerde ADD_HOST van %s (%s)" -#: src/protocol.c:689 +#: src/protocol.c:698 #, c-format msgid "Got bad ADD_HOST from %s (%s)" msgstr "Kreeg ongeldige ADD_HOST van %s (%s)" -#: src/protocol.c:699 +#: src/protocol.c:708 #, c-format msgid "Got duplicate ADD_HOST for %s (%s) from %s (%s)" msgstr "Kreeg een tweede ADD_HOST voor %s (%s) van %s (%s)" -#: src/protocol.c:706 +#: src/protocol.c:715 #, c-format msgid "Removing old entry for %s (%s)" msgstr "Verwijdering oude verbinding voor %s (%s)" -#: src/protocol.c:727 +#: src/protocol.c:725 +#, c-format +msgid "Warning: got ADD_HOST from %s (%s) for ourself, restarting" +msgstr "Waarschuwing: kreeg ADD_HOST van %s (%s) voor onszelf, herstart" + +#: src/protocol.c:745 #, c-format msgid "Got ADD_HOST for %s (%s) from %s (%s)" msgstr "Kreeg ADD_HOST voor %s (%s) van %s (%s)" -#: src/protocol.c:745 +#: src/protocol.c:763 #, c-format msgid "Got unauthorized REQ_KEY from %s (%s)" msgstr "Kreeg niet-geautoriseerde REQ_KEY van %s (%s)" -#: src/protocol.c:752 +#: src/protocol.c:770 #, c-format msgid "Got bad REQ_KEY from %s (%s)" msgstr "Kreeg ongeldige REQ_KEY van %s (%s)" -#: src/protocol.c:758 +#: src/protocol.c:776 #, c-format msgid "Got REQ_KEY origin %d.%d.%d.%d destination %d.%d.%d.%d from %s (%s)" msgstr "Kreeg REQ_KEY herkmonst %d.%d.%d.%d bestemming %d.%d.%d.%d van %s (%s)" -#: src/protocol.c:771 +#: src/protocol.c:789 #, c-format msgid "Attempting to forward REQ_KEY to %d.%d.%d.%d, which does not exist?" msgstr "Poging tot doorsturen REQ_KEY naar %d.%d.%d.%d, die niet bestaat?" -#: src/protocol.c:777 +#: src/protocol.c:795 #, c-format msgid "Forwarding REQ_KEY to %s (%s)" msgstr "Doorsturen REQ_KEY naar %s (%s)" -#: src/protocol.c:836 +#: src/protocol.c:854 #, c-format msgid "Got unauthorized ANS_KEY from %s (%s)" msgstr "Kreeg niet-geautoriseerde ANS_KEY van %s (%s)" -#: src/protocol.c:843 +#: src/protocol.c:861 #, c-format msgid "Got bad ANS_KEY from %s (%s)" msgstr "Kreeg ongeldige ANS_KEY van %s (%s)" -#: src/protocol.c:849 +#: src/protocol.c:867 #, c-format msgid "Got ANS_KEY origin %d.%d.%d.%d destination %d.%d.%d.%d from %s (%s)" msgstr "Kreeg ANS_KEY herkomst %d.%d.%d.%d bestemming %d.%d.%d.%d van %s (%s)" -#: src/protocol.c:858 +#: src/protocol.c:876 #, c-format msgid "" "Receiving ANS_KEY origin %d.%d.%d.%d from %s (%s), which does not exist?" msgstr "Kreeg ANS_KEY herkomst %d.%d.%d.%d van %s (%s), die niet bestaat?" -#: src/protocol.c:874 +#: src/protocol.c:892 #, c-format msgid "Attempting to forward ANS_KEY to %d.%d.%d.%d, which does not exist?" msgstr "Poging tot doorsturen ANS_KEY naar %d.%d.%d.%d, die niet besttaat?" -#: src/protocol.c:880 +#: src/protocol.c:898 #, c-format msgid "Forwarding ANS_KEY to %s (%s)" msgstr "Doorsturen ANS_KEY naar %s (%s)" -#: src/protocol.c:901 +#: src/protocol.c:919 #, c-format msgid "Got unauthorized KEY_CHANGED from %s (%s)" msgstr "Kreeg niet-geautoriseerde KEY_CHANGED van %s (%s)" -#: src/protocol.c:908 +#: src/protocol.c:926 #, c-format msgid "Got bad KEY_CHANGED from %s (%s)" msgstr "Kreeg ongeldige KEY_CHANGED van %s (%s)" -#: src/protocol.c:917 +#: src/protocol.c:935 #, c-format msgid "Got KEY_CHANGED origin %d.%d.%d.%d from %s (%s), which does not exist?" msgstr "Kreeg KEY_CHANGED herkomst %d.%d.%d.%d van %s (%s), die niet bestaat?" -#: src/protocol.c:923 +#: src/protocol.c:941 #, c-format msgid "Got KEY_CHANGED origin %s from %s (%s)" msgstr "Kreeg KEY_CHANGED herkomst %s van %s (%s)" @@ -889,6 +914,6 @@ msgid "Got unexpected signal %d after %s line %d" msgstr "Kreeg onverwacht signaal %d na %s regel %d" #: src/tincd.c:465 -#, c-format +#, fuzzy, c-format msgid "Got unexpected signal %d" -msgstr "Kreeg onverwacht signaal %d" +msgstr "Kreeg onverwacht signaal %d na %s regel %d" diff --git a/src/net.c b/src/net.c index efd30e6f..c7e8b857 100644 --- a/src/net.c +++ b/src/net.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: net.c,v 1.35.4.16 2000/06/30 11:45:14 guus Exp $ + $Id: net.c,v 1.35.4.17 2000/06/30 12:41:05 guus Exp $ */ #include "config.h" @@ -508,7 +508,8 @@ cp cl->meta_socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if(cl->meta_socket == -1) { - syslog(LOG_ERR, _("Creating socket failed: %m")); + syslog(LOG_ERR, _("Creating socket for %s port %d failed: %m"), + cl->real_hostname, cl->port); return -1; } @@ -525,7 +526,8 @@ cp flags = fcntl(cl->meta_socket, F_GETFL); if(fcntl(cl->meta_socket, F_SETFL, flags | O_NONBLOCK) < 0) { - syslog(LOG_ERR, _("fcntl: %m")); + syslog(LOG_ERR, _("fcntl for %s port %d: %m"), + cl->real_hostname, cl->port); return -1; } @@ -751,7 +753,8 @@ cp flags = fcntl(nfd, F_GETFL); if(fcntl(nfd, F_SETFL, flags | O_NONBLOCK) < 0) { - syslog(LOG_ERR, _("This is a bug: %s:%d: %d:%m"), __FILE__, __LINE__, nfd); + syslog(LOG_ERR, _("This is a bug: %s:%d: %d:%m %s (%s)"), __FILE__, __LINE__, nfd, + cl->vpn_hostname, cl->real_hostname); return -1; } @@ -837,12 +840,14 @@ int handle_incoming_vpn_data(conn_list_t *cl) cp if(getsockopt(cl->socket, SOL_SOCKET, SO_ERROR, &x, &l) < 0) { - syslog(LOG_ERR, _("This is a bug: %s:%d: %d:%m"), __FILE__, __LINE__, cl->socket); + syslog(LOG_ERR, _("This is a bug: %s:%d: %d:%m %s (%s)"), __FILE__, __LINE__, cl->socket, + cl->vpn_hostname, cl->real_hostname); return -1; } if(x) { - syslog(LOG_ERR, _("Incoming data socket error: %s"), sys_errlist[x]); + syslog(LOG_ERR, _("Incoming data socket error for %s (%s): %s"), + cl->vpn_hostname, cl->real_hostname, sys_errlist[x]); return -1; } @@ -850,7 +855,7 @@ cp lenin = recvfrom(cl->socket, &rp, MTU, 0, NULL, NULL); if(lenin <= 0) { - syslog(LOG_ERR, _("Receiving packet from %s failed: %m"), cl->real_hostname); + syslog(LOG_ERR, _("Receiving packet from %s (%s) failed: %m"), cl->vpn_hostname, cl->real_hostname); return -1; } total_socket_in += lenin; @@ -1033,12 +1038,14 @@ int handle_incoming_meta_data(conn_list_t *cl) cp if(getsockopt(cl->meta_socket, SOL_SOCKET, SO_ERROR, &x, &l) < 0) { - syslog(LOG_ERR, _("This is a bug: %s:%d: %d:%m"), __FILE__, __LINE__, cl->meta_socket); + syslog(LOG_ERR, _("This is a bug: %s:%d: %d:%m %s (%s)"), __FILE__, __LINE__, cl->meta_socket, + cl->vpn_hostname, cl->real_hostname); return -1; } if(x) { - syslog(LOG_ERR, _("Metadata socket error: %s"), sys_errlist[x]); + syslog(LOG_ERR, _("Metadata socket error for %s (%s): %s"), + cl->vpn_hostname, cl->real_hostname, sys_errlist[x]); return -1; } @@ -1054,7 +1061,13 @@ cp { if(errno==EINTR) return 0; - syslog(LOG_ERR, _("Metadata socket read error: %m")); + if(errno==0) + if(debug_lvl>0) + syslog(LOG_NOTICE, _("Connection closed by %s (%s)"), + cl->vpn_hostname, cl->real_hostname); + else + syslog(LOG_ERR, _("Metadata socket read error for %s (%s): %m"), + cl->vpn_hostname, cl->real_hostname); return -1; } @@ -1251,6 +1264,7 @@ cp syslog(LOG_ERR, _("Unable to reread configuration file, exiting")); exit(0); } + sleep(5); setup_network_connections(); continue; } diff --git a/src/protocol.c b/src/protocol.c index a6f30290..f8d72298 100644 --- a/src/protocol.c +++ b/src/protocol.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: protocol.c,v 1.28.4.17 2000/06/29 19:47:03 guus Exp $ + $Id: protocol.c,v 1.28.4.18 2000/06/30 12:41:06 guus Exp $ */ #include "config.h" @@ -613,6 +613,15 @@ cp return 0; } + /* Connections lists are really messed up if this happens */ + if(vpn_ip == myself->vpn_ip) + { + syslog(LOG_ERR, _("Warning: got DEL_HOST from %s (%s) for ourself, restarting"), + cl->vpn_hostname, cl->real_hostname); + sighup = 1; + return 0; + } + if(debug_lvl > 1) syslog(LOG_DEBUG, _("Got DEL_HOST for %s (%s) from %s (%s)"), fw->vpn_hostname, fw->real_hostname, cl->vpn_hostname, cl->real_hostname); @@ -709,6 +718,15 @@ cp terminate_connection(old); } } + + /* Connections lists are really messed up if this happens */ + if(vpn_ip == myself->vpn_ip) + { + syslog(LOG_ERR, _("Warning: got ADD_HOST from %s (%s) for ourself, restarting"), + cl->vpn_hostname, cl->real_hostname); + sighup = 1; + return 0; + } ncn = new_conn_list(); ncn->real_ip = real_ip;