FreeBSD Bugzilla – Attachment 17013 Details for
Bug 31029
syslogd remote logging back down
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 2.44 KB, created by
AnarCat
on 2001-10-04 09:30:01 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
AnarCat
Created:
2001-10-04 09:30:01 UTC
Size:
2.44 KB
patch
obsolete
>--- syslogd.c.orig Wed Oct 3 15:56:32 2001 >+++ syslogd.c Thu Oct 4 00:06:49 2001 >@@ -142,6 +142,9 @@ > #define MARK 0x008 /* this message is a mark */ > #define ISKERNEL 0x010 /* kernel generated message */ > >+#define DELAY_MUL 2 /* delay multiplier */ >+#define DELAY_INIT 30 /* initial delay in seconds */ >+ > /* > * This structure represents the files that will have log > * copies printed. >@@ -159,6 +162,9 @@ > #define PRI_EQ 0x2 > #define PRI_GT 0x4 > char *f_program; /* program this applies to */ >+ /* should this be part of the union? */ >+ time_t f_unreach; /* time since last unreach */ >+ time_t f_delay; /* backoff time */ > union { > char f_uname[MAXUNAMES][UT_NAMESIZE+1]; > struct { >@@ -999,6 +1005,15 @@ > l = MAXLINE; > > if (finet) { >+ dprintf("FORW: now: %d f_unreach: %d f_delay: %d\n", (int) now, (int) f->f_unreach, (int) f->f_delay); >+ /* XXX: must make sure this is initialized to 0 */ >+ if (f->f_unreach) { /* there was a failure last time */ >+ dprintf("another try at host\n"); >+ if ( (now - f->f_unreach) < f->f_delay) { >+ dprintf("skipping: now: %d, f_unreach: %d f_delay: %d\n", (int) now, (int) f->f_unreach, (int) f->f_delay); >+ break; /* do not send */ >+ } >+ } > for (r = f->f_un.f_forw.f_addr; r; r = r->ai_next) { > for (i = 0; i < *finet; i++) { > #if 0 >@@ -1017,12 +1032,38 @@ > if (lsent == l && !send_to_all) > break; > } >+ dprintf("lsent: %d\n", lsent); > if (lsent != l) { > int e = errno; >- (void)close(f->f_file); >- errno = e; >- f->f_type = F_UNUSED; >+ dprintf("sendto: f_unreach: %d f_delay: %d\n", (int) f->f_unreach, (int) f->f_delay); > logerror("sendto"); >+ errno = e; >+ switch (errno) { >+ case EHOSTUNREACH: >+ case EHOSTDOWN: >+ if (f->f_unreach) >+ f->f_delay *= DELAY_MUL; >+ else { >+ f->f_unreach = now; >+ f->f_delay = DELAY_INIT; >+ } >+ dprintf("setting: f_unreach: %d f_delay: %d\n", (int) f->f_unreach, (int) f->f_delay); >+ break; >+ /* case EBADF: */ >+ /* case EACCES: */ >+ /* case ENOTSOCK: */ >+ /* case EFAULT: */ >+ /* case EMSGSIZE: */ >+ /* case EAGAIN: */ >+ /* case ENOBUFS: */ >+ /* case ECONNREFUSED: */ >+ default: >+ dprintf("removing entry\n", e); >+ (void)close(f->f_file); >+ errno = e; >+ f->f_type = F_UNUSED; >+ break; >+ } > } > } > break; >@@ -2301,3 +2342,7 @@ > > return(socks); > } >+ >+/* Local Variables: *** */ >+/* c-basic-offset:8 *** */ >+/* End: *** */
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 31029
: 17013