2010-08-15 09:53:21 +00:00
|
|
|
--- a/sysklogd/syslogd.c
|
|
|
|
+++ b/sysklogd/syslogd.c
|
|
|
|
@@ -98,6 +98,8 @@ struct globals {
|
|
|
|
GLOBALS
|
|
|
|
|
|
|
|
#if ENABLE_FEATURE_REMOTE_LOG
|
|
|
|
+ len_and_sockaddr *remoteAddr;
|
|
|
|
+ int remoteFD;
|
|
|
|
llist_t *remoteHosts;
|
|
|
|
#endif
|
|
|
|
#if ENABLE_FEATURE_IPC_SYSLOG
|
|
|
|
@@ -554,6 +556,7 @@ static void do_syslogd(void) NORETURN;
|
2010-06-27 12:18:12 +00:00
|
|
|
static void do_syslogd(void)
|
|
|
|
{
|
|
|
|
int sock_fd;
|
|
|
|
+ int send_err = 0;
|
2010-08-15 09:53:21 +00:00
|
|
|
#if ENABLE_FEATURE_REMOTE_LOG
|
|
|
|
llist_t *item;
|
|
|
|
#endif
|
|
|
|
@@ -637,10 +640,23 @@ static void do_syslogd(void)
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
/* Send message to remote logger, ignore possible error */
|
2010-06-27 12:18:12 +00:00
|
|
|
- /* TODO: on some errors, close and set G.remoteFD to -1
|
|
|
|
- * so that DNS resolution and connect is retried? */
|
2010-08-15 09:53:21 +00:00
|
|
|
- sendto(rh->remoteFD, recvbuf, sz+1, MSG_DONTWAIT,
|
|
|
|
- &(rh->remoteAddr->u.sa), rh->remoteAddr->len);
|
|
|
|
+ if (sendto(rh->remoteFD, recvbuf, sz+1, MSG_DONTWAIT,
|
|
|
|
+ &G.remoteAddr->u.sa, G.remoteAddr->len) == -1 ) {
|
2010-06-27 12:18:12 +00:00
|
|
|
+ send_err = errno;
|
2010-08-15 09:53:21 +00:00
|
|
|
+ }
|
2010-06-27 12:18:12 +00:00
|
|
|
+
|
|
|
|
+ /* On some errors, close and set G.remoteFD to -1
|
|
|
|
+ * so that DNS resolution and connect is retried */
|
2010-08-15 09:53:21 +00:00
|
|
|
+ switch (send_err) {
|
|
|
|
+ case ECONNRESET:
|
|
|
|
+ case EDESTADDRREQ:
|
|
|
|
+ case EISCONN:
|
|
|
|
+ case ENOTCONN:
|
|
|
|
+ case EPIPE:
|
2010-06-27 12:18:12 +00:00
|
|
|
+ close(G.remoteFD);
|
|
|
|
+ G.remoteFD = -1;
|
|
|
|
+ break;
|
2010-08-15 09:53:21 +00:00
|
|
|
+ }
|
2010-06-27 12:18:12 +00:00
|
|
|
}
|
|
|
|
#endif
|
2010-08-15 09:53:21 +00:00
|
|
|
if (!ENABLE_FEATURE_REMOTE_LOG || (option_mask32 & OPT_locallog)) {
|