diff --git a/Changes b/Changes index 645046078..a025c82c7 100644 --- a/Changes +++ b/Changes @@ -1848,3 +1848,5 @@ This change should not break extban modules, and should need some more extensive testing. - Misc fix for disabling extban chains, should've done stuff in our autoconf stuff instead of hacking configure directly :P . +- Made the timesynch log output more clear and understandable. +- Added an 'UnrealIRCd started' log message on startup. diff --git a/src/ircd.c b/src/ircd.c index 9e04d8082..67facf542 100644 --- a/src/ircd.c +++ b/src/ircd.c @@ -1536,6 +1536,7 @@ int InitwIRCD(int argc, char *argv[]) me.umodes = conf_listen->options; conf_listen->listener = &me; run_configuration(); + ircd_log(LOG_ERROR, "UnrealIRCd started."); botmotd = (aMotd *) read_file(conf_files->botmotd_file, NULL); rules = (aMotd *) read_file(conf_files->rules_file, NULL); opermotd = (aMotd *) read_file(conf_files->opermotd_file, NULL); @@ -1623,7 +1624,9 @@ int InitwIRCD(int argc, char *argv[]) if (TIMESYNCH) { if (!unreal_time_synch(TIMESYNCH_TIMEOUT)) - ircd_log(LOG_ERROR, "TIME SYNCH: Unable to synchronize time: %s. This happens sometimes, no error on your part.", + ircd_log(LOG_ERROR, "TIME SYNCH: Unable to synchronize time: %s. " + "This means UnrealIRCd was unable to synchronize the IRCd clock to a known good time source. " + "As long as the server owner keeps the server clock synchronized through NTP, everything will be fine.", unreal_time_synch_error()); } fix_timers(); /* Fix timers AFTER reading tune file AND timesynch */ diff --git a/src/timesynch.c b/src/timesynch.c index 349504f43..ad8c2035a 100644 --- a/src/timesynch.c +++ b/src/timesynch.c @@ -156,6 +156,7 @@ int n, addrlen, i, highestfd = 0; fd_set r; struct timeval tv; char buf[512], *buf_out; +int succesfully_sent = 0; strlcpy(tmptimeservbuf, TIMESYNCH_SERVER, sizeof(tmptimeservbuf)); @@ -193,10 +194,18 @@ char buf[512], *buf_out; { n = sendto(s[i], buf_out, TSPKTLEN, 0, (struct sockaddr *)&addr[i], sizeof(struct sockaddr_in)); if (n < 0) - ircd_log(LOG_ERROR, "TimeSync: WARNING: Was unable to send message to server #%d...", i); + ircd_log(LOG_ERROR, "TimeSync: WARNING: Was unable to send packet to server #%d... ", i); + else + succesfully_sent++; } - + if (!succesfully_sent) + { + ircd_log(LOG_ERROR, "TimeSync: WARNING: Unable to send time synchronization packets to ANY time server. " + "Perhaps your firewall is blocking outgoing packets to UDP port 123?"); + strcpy(tserr, "Unable to send packets"); + goto end; + } start = time(NULL); /* yes, indeed.. not TStime() here.. that is correct */ @@ -260,8 +269,11 @@ gotit: now = time(NULL); offset = t - now; - ircd_log(LOG_ERROR, "TIME SYNCH: timeserver=%ld, our=%ld, offset = %ld [old offset: %ld]\n", - (long)t, (long)now, (long)offset, (long)TSoffset); + if ((offset >= -1) && (offset <= 1)) /* no offset (or only +1/-1) */ + ircd_log(LOG_ERROR, "TIME SYNCH: IRCd clock succesfully synchronized to known good time source."); + else + ircd_log(LOG_ERROR, "TIME SYNCH: IRCd clock succesfully synchronized to known good time source [offset: %ld, was: %ld].", + (long)offset, (long)TSoffset); TSoffset = offset;