diff options
author | cshore <cshore@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2010-06-27 12:18:12 +0000 |
---|---|---|
committer | cshore <cshore@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2010-06-27 12:18:12 +0000 |
commit | 03dd7f31977df09b73dd223730c77adbaa6bcf5f (patch) | |
tree | 7e82ba68ce1930151c2f15c5ac0bc4c8a9cc305a /package | |
parent | b4e1fa137c502705392694750473d4f84ec5cf57 (diff) |
busybox: Fixed remote logging bug in which starting syslog before the network (and hence the remote host being available) results in failure to do any remote logging
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@21961 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package')
-rw-r--r-- | package/busybox/patches/610-syslog-remote-retry-connection.patch | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/package/busybox/patches/610-syslog-remote-retry-connection.patch b/package/busybox/patches/610-syslog-remote-retry-connection.patch new file mode 100644 index 0000000000..5602e2b51d --- /dev/null +++ b/package/busybox/patches/610-syslog-remote-retry-connection.patch @@ -0,0 +1,40 @@ +Index: busybox-1.16.1/sysklogd/syslogd.c +=================================================================== +--- busybox-1.16.1.orig/sysklogd/syslogd.c 2010-03-28 13:44:04.000000000 -0400 ++++ busybox-1.16.1/sysklogd/syslogd.c 2010-06-17 21:48:11.000000000 -0400 +@@ -555,6 +555,7 @@ + static void do_syslogd(void) + { + int sock_fd; ++ int send_err = 0; + #if ENABLE_FEATURE_SYSLOGD_DUP + int last_sz = -1; + char *last_buf; +@@ -632,10 +633,23 @@ + * over network, mimic that */ + recvbuf[sz] = '\n'; + /* send message to remote logger, ignore possible error */ +- /* TODO: on some errors, close and set G.remoteFD to -1 +- * so that DNS resolution and connect is retried? */ +- sendto(G.remoteFD, recvbuf, sz+1, MSG_DONTWAIT, +- &G.remoteAddr->u.sa, G.remoteAddr->len); ++ if ( sendto(G.remoteFD, recvbuf, sz+1, MSG_DONTWAIT, ++ &G.remoteAddr->u.sa, G.remoteAddr->len) == -1 ) { ++ send_err = errno; ++ } ++ ++ /* On some errors, close and set G.remoteFD to -1 ++ * so that DNS resolution and connect is retried */ ++ switch (send_err) { ++ case ECONNRESET: ++ case EDESTADDRREQ: ++ case EISCONN: ++ case ENOTCONN: ++ case EPIPE: ++ close(G.remoteFD); ++ G.remoteFD = -1; ++ break; ++ } + no_luck: ; + } + #endif |