tag 660897 + patch thanks The attached patch fixes the issue, and allows syslog-ng to start up even when the destination loghost is not resolvable. It's perhaps not the nicest patch possible, and I will probably have to redo it before it can be merged upstream, but it gets the job done until then.
-- |8]
>From c7cccebdce84cabb30feb609dbd9214d2e02ed36 Mon Sep 17 00:00:00 2001 From: Gergely Nagy <[email protected]> Date: Fri, 30 Mar 2012 13:29:15 +0200 Subject: [PATCH] afsocket: Do not die if a destination is not resolvable at startup. If a destination cannot be resolved at init time, do not panic, just bail out, but otherwise pretend we succeeded: after time_reopen, we'll retry anyway! And on that note, teach afsocket_dd_start_connect() to call afsocket_dd_apply_transport() if our fd is -1 (ie, not connected). Reported-by: Peter Palfrader <[email protected]> Signed-off-by: Gergely Nagy <[email protected]> --- modules/afsocket/afinet.c | 2 +- modules/afsocket/afsocket.c | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/afsocket/afinet.c b/modules/afsocket/afinet.c index f83ff38..a7d3635 100644 --- a/modules/afsocket/afinet.c +++ b/modules/afsocket/afinet.c @@ -498,7 +498,7 @@ afinet_dd_apply_transport(AFSocketDestDriver *s) if ((self->bind_ip && !resolve_hostname(&self->super.bind_addr, self->bind_ip)) || !resolve_hostname(&self->super.dest_addr, self->super.hostname)) - return FALSE; + return TRUE; afinet_set_port(self->super.dest_addr, self->dest_port ? : default_dest_port, self->super.flags & AFSOCKET_DGRAM ? "udp" : "tcp"); diff --git a/modules/afsocket/afsocket.c b/modules/afsocket/afsocket.c index ae9c5c2..095f5a5 100644 --- a/modules/afsocket/afsocket.c +++ b/modules/afsocket/afsocket.c @@ -1103,6 +1103,11 @@ afsocket_dd_start_connect(AFSocketDestDriver *self) gchar buf1[MAX_SOCKADDR_STRING], buf2[MAX_SOCKADDR_STRING]; main_loop_assert_main_thread(); + + if (self->fd == -1) + if (!afsocket_dd_apply_transport(self)) + return FALSE; + if (!afsocket_open_socket(self->bind_addr, !!(self->flags & AFSOCKET_STREAM), &sock)) { return FALSE; @@ -1169,10 +1174,7 @@ afsocket_dd_init(LogPipe *s) /* these fields must be set up by apply_transport, so let's check if it indeed did */ g_assert(self->transport); - g_assert(self->bind_addr); - g_assert(self->dest_addr); g_assert(self->hostname); - g_assert(self->dest_name); if (cfg) { -- 1.7.9

