NetBSD Problem Report #5860

Received: (qmail 2469 invoked from network); 27 Jul 1998 01:36:38 -0000
Message-Id: <m0z0cDI-0009NtC@most.weird.com>
Date: Sun, 26 Jul 1998 21:36:32 -0400 (EDT)
From: woods@most.weird.com
Reply-To: woods@planix.com
To: gnats-bugs@gnats.netbsd.org
Subject: syslogd doesn't properly identify messages forwarded from another host
X-Send-Pr-Version: 3.95

>Number:         5860
>Category:       bin
>Synopsis:       syslogd doesn't properly identify messages forwarded from another host
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun Jul 26 18:50:01 +0000 1998
>Closed-Date:    Thu Jul 30 23:29:03 +0000 1998
>Last-Modified:  Thu Jul 30 23:29:49 +0000 1998
>Originator:     Greg A. Woods
>Release:        NetBSD-current 1998-07-26
>Organization:
Planix, Inc.; Toronto, Ontario; Canada
>Environment:

System: NetBSD most 1.3.1 NetBSD 1.3.1 (MOST) #0: Mon May 25 01:21:22 EDT 1998 woods@most:/usr/src-1.3.1/sys/arch/sparc/compile/MOST sparc

>Description:

	Finally in FreeBSD's PR#bin/7055 there comes a fix for syslogd
	to make it properly idenify messages forwarded from a remote host.

>How-To-Repeat:

	Try setting up a log host that also fowards some messages to
	other hosts.

	Read FreeBSD's PR#bin/7055.

>Fix:

	Apply the following patch:

Index: syslogd.c
===================================================================
RCS file: /cvs/NetBSD/src/usr.sbin/syslogd/syslogd.c,v
retrieving revision 1.1.1.2
diff -c -r1.1.1.2 syslogd.c
*** syslogd.c	1998/07/26 20:35:06	1.1.1.2
--- syslogd.c	1998/07/27 01:32:43
***************
*** 657,664 ****

  	case F_FORW:
  		dprintf(" %s\n", f->f_un.f_forw.f_hname);
! 		l = snprintf(line, sizeof line, "<%d>%.15s %s", f->f_prevpri,
! 		    (char *)iov[0].iov_base, (char *)iov[4].iov_base);
  		if (l > MAXLINE)
  			l = MAXLINE;
  		if ((finet >= 0) &&
--- 657,673 ----

  	case F_FORW:
  		dprintf(" %s\n", f->f_un.f_forw.f_hname);
! 		/* check for local vs remote messages (from FreeBSD PR#bin/7055) */
! 		if (strcmp(f->f_prevhost, LocalHostName)) {
! 			l = snprintf(line, sizeof(line) - 1,
! 				     "<%d>%.15s Forwarded from %s: %s",
! 				     f->f_prevpri, (char *) iov[0].iov_base,
! 				     f->f_prevhost, (char *) iov[4].iov_base);
! 		} else {
! 			l = snprintf(line, sizeof(line) - 1, "<%d>%.15s %s",
! 				     f->f_prevpri, (char *) iov[0].iov_base,
! 				     (char *) iov[4].iov_base);
! 		}
  		if (l > MAXLINE)
  			l = MAXLINE;
  		if ((finet >= 0) &&

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->analyzed 
State-Changed-By: tron 
State-Changed-When: Mon Jul 27 16:50:20 PDT 1998 
State-Changed-Why:  
A patch like that should definitely be added. Only the output format is 
still under discussion. 

From: woods@most.weird.com (Greg A. Woods)
To: gnats-bugs@gnats.netbsd.org
Cc:  Subject: Re: bin/5860
Date: Tue, 28 Jul 1998 09:46:32 -0400 (EDT)

 [ On , July 27, 1998 at 23:51:49 (-0000), tron@NetBSD.ORG wrote: ]
 > Subject: Re: bin/5860
 >
 > Synopsis: syslogd doesn't properly identify messages forwarded from another host
 > 
 > State-Changed-From-To: open->analyzed
 > State-Changed-By: tron
 > State-Changed-When: Mon Jul 27 16:50:20 PDT 1998
 > State-Changed-Why: 
 > A patch like that should definitely be added. Only the output format is
 > still under discussion.

 OK, thanks!

 In testing this patch I've found that it does not do one of the things
 I'd been hoping it might do (or at least enable it to do), which is to
 prevent syslogd loops between two hosts forwarding to each other.  I've
 not yet looked at the looping problem in detail -- perhaps the only way
 to really fix this is to allow fowarding to change the facility (and
 priority) on the sending host.  (Consider the situation where all hosts
 forward their logs to a central host, but you may want *.crit forwarded
 back to every host with a /dev/console.)

 I should point out that the FreeBSD guys have also added some other new
 and possibly useful features to syslogd (esp. a '-v' option that allows
 logging of the facility and priority with the message), so if anyone's
 going to work on syslogd I'd encourage them to take a look at the latest
 FreeBSD version (i.e. the one in their -current).

 -- 
 							Greg A. Woods

 +1 416 443-1734      VE3TCP      <gwoods@acm.org>      <robohack!woods>
 Planix, Inc. <woods@planix.com>; Secrets of the Weird <woods@weird.com>
State-Changed-From-To: analyzed->closed 
State-Changed-By: tron 
State-Changed-When: Thu Jul 30 16:29:03 PDT 1998 
State-Changed-Why:  
Patch applied with a little modification, thanks. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.