From owner-freebsd-current@freebsd.org  Sat Jan 20 06:21:14 2001
Return-Path: <owner-freebsd-current@freebsd.org>
Received: from amsmta03-svc.chello.nl (mail-out.chello.nl [213.46.240.7])
	by hub.freebsd.org (Postfix) with ESMTP
	id 8CE2537B69C; Sat, 20 Jan 2001 06:21:13 -0800 (PST)
Received: from bsdserver.smalweer.nl ([213.93.216.127])
          by amsmta03-svc.chello.nl
          (InterMail vK.4.02.00.10 201-232-116-110 license 85b07e7cd9378159aa6ecc9a5634d971)
          with ESMTP
          id <20010120113053.IEXL7195.amsmta03-svc@bsdserver.smalweer.nl>;
          Sat, 20 Jan 2001 12:30:53 +0100
Received: from pop3.demon.nl (account zappa)
  by bsdserver.smalweer.nl (CommuniGate Pro RPOP 3.3.2)
  with RPOP id 10217; Sat, 20 Jan 2001 12:30:09 +0100
Received: from punt-14.mail.nl.demon.net by mailstore for ron@zappa.demon.nl
          id 979982846:14:24329:0; Sat, 20 Jan 2001 09:27:26 GMT
Received: from mx1.freebsd.org ([216.136.204.125]) by punt-12.mail.nl.demon.net
           id aa1221693; 20 Jan 2001 9:27 GMT
Received: from hub.freebsd.org (hub.FreeBSD.org [216.136.204.18])
	by mx1.FreeBSD.org (Postfix) with ESMTP
	id E16FB6E2824; Sat, 20 Jan 2001 01:26:22 -0800 (PST)
Received: by hub.freebsd.org (Postfix, from userid 538)
	id A1BEE37B402; Sat, 20 Jan 2001 01:26:21 -0800 (PST)
Received: from localhost (localhost [127.0.0.1])
	by hub.freebsd.org (Postfix) with SMTP
	id 7CA2A2E8193; Sat, 20 Jan 2001 01:26:21 -0800 (PST)
Received: by hub.freebsd.org (bulk_mailer v1.12); Sat, 20 Jan 2001 01:26:21 -0800
Received: from gratis.grondar.za (grouter.grondar.za [196.7.18.65])
	by hub.freebsd.org (Postfix) with ESMTP
	id 477F337B400; Sat, 20 Jan 2001 01:25:57 -0800 (PST)
Received: from grondar.za (root@gratis.grondar.za [196.7.18.133])
	by gratis.grondar.za (8.11.1/8.11.1) with ESMTP id f0K9O8I52405;
	Sat, 20 Jan 2001 11:24:27 +0200 (SAST)
	(envelope-from mark@grondar.za)
Message-Id: <200101200924.f0K9O8I52405@gratis.grondar.za>
Date: Sat, 20 Jan 2001 11:24:16 +0200
From: Mark Murray <mark@grondar.za>
Sender: owner-freebsd-current@FreeBSD.ORG
To: cjclark@alum.mit.edu
Cc: FreeBSD-gnats-submit@FreeBSD.ORG, current@FreeBSD.ORG
In-Reply-To: <200101190330.f0J3UPa75677@rfx-216-196-73-168.users.reflexcom.com> ; from cjclark@reflexcom.com  "Thu, 18 Jan 2001 19:30:25 PST."
Subject: Re: syslogd(8) does not update hostname 
References: <200101190330.f0J3UPa75677@rfx-216-196-73-168.users.reflexcom.com> 

>Number:         24484
>Category:       bin
>Synopsis:       Re: syslogd(8) does not update hostname
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    gnats-admin
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Jan 20 06:30:02 PST 2001
>Closed-Date:    Mon Feb 19 12:31:58 PST 2001
>Last-Modified:  Wed Oct 26 06:34:36 GMT 2005
>Originator:     
>Release:        
>Organization:
>Environment:
>Description:
 *This message was transferred with a trial version of CommuniGate(tm) Pro*
 I don't agree with this change.
 
 hostname != name-that-IP-address-resolves-to.
 
 I can see how loggin the IP address (or some manifestation thereof) to
 a central logger, but this is too strong.
 
 Example: My laptop has a hostname set for my home network, and I connect
 it to my work network and DHCP an IP address there. I would be HOPPING
 mad if that caused my hostname and VPN to break.
 
 M
 
 > >Submitter-Id:   current-users
 > >Originator:     Crist J. Clark
 > >Organization:   
 > >Confidential:   no
 > >Synopsis:       syslogd(8) does not update hostname
 > >Severity:       non-critical
 > >Priority:       medium
 > >Category:       bin
 > >Release:        FreeBSD 5.0-CURRENT i386
 > >Class:          sw-bug
 > >Environment: 
 > 
 > 	All standard FreeBSD distributions. The code discussed is from
 > 5.0-CURRENT, but should trivially merge back to -STABLE.
 > 
 > >Description: 
 > 
 > 	Many tools and progams within FreeBSD date back to a time when
 > it was expected that a machines IP and hostname seldom, if ever,
 > changed. Even when a IP and hostname were received at boot, it rarely
 > changed until shutdown. With many users using protocols like DHCP
 > where IP and hostname change with time, many tools do not deal well
 > with this behavior.
 > 
 > 	One of these tools is syslogd(8). syslogd(8) is typically
 > started at boot time and runs until shutdown. However, syslogd(8)
 > loads the hostname at startup and syslogd(8)'s idea of the hostname
 > can never change while it is running.
 > 
 > 	One might expect that a SIGHUP would cause syslogd(8) to load
 > the new hostname since a SIGHUP can cause syslogd(8) to re-read its
 > configuration file and re-open the log files, but it does not.
 > 
 > 	The fact that the hostname does not change can cause confusion
 > in the log files. It could be especially troublesome when a machine is
 > logging to a central loghost. At any given time, the names in the log
 > files may not have any correspondence to the names the hosts currently
 > have. There are even issues on a host that gets its IP and hostname
 > via DHCP at boot and the name never changes. syslogd(8) is started
 > before any network services are initialized in /etc/rc.
 > 
 > 	I propose that syslogd(8) should reload the hostname with a
 > SIGHUP. I cannot think of any reason that one should not update the
 > hostname, but as I pointed out, there are reasons why one would want
 > that behavior.
 > 
 > >How-To-Repeat: 
 > 
 > 	# hostname -s
 > 	bubbles
 > 	# hostname bubbles-test.domain.org
 > 	# kill -HUP `cat /var/run/syslog.pid`
 > 	# logger -p user.notice "hostname test"
 > 	# tail -4 /var/log/messages
 > 	Jan 17 21:45:00 bubbles /boot/kernel/kernel: acd0: CDROM <CD-532E-A> at ata0-slave using BIOSPIO
 > 	Jan 17 21:45:00 bubbles /boot/kernel/kernel: Mounting root from ufs:/dev/ad0s1a
 > 	Jan 18 00:41:14 bubbles su: cjc to root on /dev/ttyp0
 > 	Jan 18 00:58:34 bubbles cjc: hostname test
 > 
 > >Fix: 
 > 
 > 	I do not see any reason we cannot move the code that gets the
 > hostname from the main() function into init(). init() is called when
 > to "reload" settings. The hostname is never used in main() before
 > init() is called. The patch is against -CURRENT and my box has not
 > exploded yet.
 > 
 > 	Here is what the above test looks like with the change in
 > place.
 > 
 > 	# hostname -s
 > 	bubbles
 > 	# hostname bubbles-test.cjclark.org
 > 	# kill -HUP `cat /var/run/syslog.pid `
 > 	# logger -p user.notice "syslogd hostname test"
 > 	# hostname bubbles.cjclark.org
 > 	# kill -HUP `cat /var/run/syslog.pid `
 > 	# logger -p user.notice "syslogd hostname test"
 > 	# tail -4 /var/log/messages
 > 	Jan 18 13:36:58 bubbles su: BAD SU cjc to root on /dev/ttyp0
 > 	Jan 18 13:37:03 bubbles su: cjc to root on /dev/ttyp0
 > 	Jan 18 13:38:40 bubbles-test cjc: syslogd hostname test
 > 	Jan 18 13:39:11 bubbles cjc: syslogd hostname test
 > 
 > 
 > --- syslogd.c   2001/01/18 08:06:34
 > +++ syslogd.c   2001/01/18 08:09:23
 > @@ -395,12 +395,6 @@
 >  
 >         consfile.f_type = F_CONSOLE;
 >         (void)strcpy(consfile.f_un.f_fname, ctty + sizeof _PATH_DEV - 1);
 > -       (void)gethostname(LocalHostName, sizeof(LocalHostName));
 > -       if ((p = strchr(LocalHostName, '.')) != NULL) {
 > -               *p++ = '\0';
 > -               LocalDomain = p;
 > -       } else
 > -               LocalDomain = "";
 >         (void)strcpy(bootfile, getbootfile());
 >         (void)signal(SIGTERM, die);
 >         (void)signal(SIGINT, Debug ? die : SIG_IGN);
 > @@ -1342,6 +1336,16 @@
 >         char host[MAXHOSTNAMELEN+1];
 >  
 >         dprintf("init\n");
 > +
 > +       /*
 > +        * Load hostname (may have changed)
 > +        */
 > +       (void)gethostname(LocalHostName, sizeof(LocalHostName));
 > +       if ((p = strchr(LocalHostName, '.')) != NULL) {
 > +               *p++ = '\0';
 > +               LocalDomain = p;
 > +       } else
 > +               LocalDomain = "";
 >  
 >         /*
 >          *  Close all open log files.
 > 
 > 
 > To Unsubscribe: send mail to majordomo@FreeBSD.org
 > with "unsubscribe freebsd-current" in the body of the message
 > 
 -- 
 Mark Murray
 Warning: this .sig is umop ap!sdn
 
 
 To Unsubscribe: send mail to majordomo@FreeBSD.org
 with "unsubscribe freebsd-current" in the body of the message
 
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: billf 
State-Changed-When: Mon Feb 19 12:31:58 PST 2001 
State-Changed-Why:  
PR is a reply to a PR 

http://www.freebsd.org/cgi/query-pr.cgi?pr=24484 
>Unformatted:
