From 69331684e18f0898f9c317d6d84642a47e520bcb Mon Sep 17 00:00:00 2001 From: Joey Schulze Date: Wed, 25 Feb 1998 12:20:58 +0000 Subject: [PATCH] * Corrected Topi's patch as it prevented forwarding during startup due to an unknown LogPort. * Finalized it --- README.linux | 3 +++ syslogd.c | 29 +++++++++++++++++------------ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/README.linux b/README.linux index b80dcb5..4d94d04 100644 --- a/README.linux +++ b/README.linux @@ -44,6 +44,9 @@ The lists address is sysklogd@Infodrom.North.DE . To subscribe send a mail to Majordomo@Infodrom.North.DE with a line "subscribe sysklogd" in the message body. +New versions of this package will be available at Joey's ftp server. +ftp://ftp.infodrom.north.de/pub/people/joey/sysklogd/ + Best regards, Dr. Wettstein diff --git a/syslogd.c b/syslogd.c index d69254b..bbed20b 100644 --- a/syslogd.c +++ b/syslogd.c @@ -347,6 +347,10 @@ static char sccsid[] = "@(#)syslogd.c 5.27 (Berkeley) 10/10/88"; * Wed Feb 25 10:54:09 CET 1998: Martin Schulze * Fixed little comparison mistake that prevented the MARK * feature to work properly. + * + * Wed Feb 25 13:21:44 CET 1998: Martin Schulze + * Corrected Topi's patch as it prevented forwarding during + * startup due to an unknown LogPort. */ @@ -1050,7 +1054,6 @@ static int create_unix_socket() static int create_inet_socket() { int fd, on = 1; - struct servent *sp; struct sockaddr_in sin; fd = socket(AF_INET, SOCK_DGRAM, 0); @@ -1059,17 +1062,8 @@ static int create_inet_socket() return fd; } - sp = getservbyname("syslog", "udp"); - if (sp == NULL) { - errno = 0; - logerror("network logging disabled (syslog/udp service unknown)."); - logerror("see syslogd(8) for details of whether and how to enable it."); - close(fd); - return -1; - } - sin.sin_family = AF_INET; - sin.sin_port = LogPort = sp->s_port; + sin.sin_port = LogPort; sin.sin_addr.s_addr = 0; if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, \ (char *) &on, sizeof(on)) < 0 ) { @@ -1936,7 +1930,7 @@ void logerror(type) { char buf[100]; - dprintf("Called loggerr, msg: %s\n", type); + dprintf("Called logerr, msg: %s\n", type); if (errno == 0) (void) sprintf(buf, "syslogd: %s", type); @@ -1999,6 +1993,16 @@ void init() #else char cline[BUFSIZ]; #endif + struct servent *sp; + + sp = getservbyname("syslog", "udp"); + if (sp == NULL) { + errno = 0; + logerror("network logging disabled (syslog/udp service unknown)."); + logerror("see syslogd(8) for details of whether and how to enable it."); + return; + } + LogPort = sp->s_port; /* * Close all open log files and free log descriptor array. @@ -2385,6 +2389,7 @@ void cfline(line, f) } else { f->f_type = F_FORW; } + bzero((char *) &f->f_un.f_forw.f_addr, sizeof(f->f_un.f_forw.f_addr)); f->f_un.f_forw.f_addr.sin_family = AF_INET;