[ previous ] [ next ] [ threads ]
 
 From:  Virgil Champlin <champlin at stupidog dot org>
 To:  m0n0wall at lists dot m0n0 dot ch
 Subject:  Re: [m0n0wall] ALIX system time
 Date:  Sun, 17 Feb 2008 13:05:05 -0800
On Feb 17, 2008, at 3:40 AM, JR wrote:

> While I stand by what I said about msntp and it's timeout issue, I'm
> pretty sure I've just discovered the real source of my time problem.
> It seems msntp has a bug where it will not resolve hostnames that
> begin with a number; instead it tries to treat them as IP addresses.
> When I tested earlier using a default config, the ntp server was still
> set to pool.ntp.org. After setting it to 0.north-america.pool.ntp.org
> it failed to set the clock on a cold boot. Running msntp manually
> gives:
>
> # msntp -r -P no -l /var/run/msntp.pid -x 300 0.north- 
> america.pool.ntp.org
> msntp: invalid IP number 0.north-america.pool.ntp.org
>
> This is strange and unexpected since '0' is in fact a valid hostname
> and other ntp tools like ntpdate have no problem with
> 0.north-america.pool.ntp.org. I guess I will have to make sure I am
> using north-america.pool.ntp.org instead.

You are correct and it is confirmed in the source of v1.6 (October  
2000):

/* Look up the Internet name or IP number. */

         if (! isdigit(hostname[0])) {
             errno = 0;
             host = gethostbyname(hostname);
         } else {
             if ((ipaddr = inet_addr(hostname)) == (unsigned long)-1)
                 fatal(0,"invalid IP number %s",hostname);
             network_to_address(address,ipaddr);
             errno = 0;
             host = gethostbyaddr((void *)address,sizeof(struct  
in_addr),
                 AF_INET);
         }

This hasn't been necessary since Bind 4.9.2 (c.1996?) which allowed  
gethostbyname to accept a dotted quad string.  However it may be a  
holdover from an earlier nascent version of msntp.  It is easy to fix  
but who do you send the patch to since the last update of msntp was  
October 2000?  That's a very long time in Internet years.  I'll try a  
couple of places and let you know.

-virgil