[ntp:hackers] Cool new stuff

Sachin Kamboj skamboj at gmail.com
Mon Jul 24 15:30:48 UTC 2006


On 7/22/06, Danny Mayer <mayer at ntp.isc.org> wrote:
>
>
> I'm not sure I understand why they need to be reserved words. The syntax
> should be clearly established to differentiate between a name and a
> value on a line. If you can't then the syntax should be revised.


The fact that keywords are reserved has nothing to do with the syntax or the
parser. It has to do with the scanner (lexical analyzer). To keep things
simple, the parser asks the scanner for the next token. The scanner on
seeing the keyword, returns the token for the keyword instead of returning a
string, which is what the parser expects. The scanner does not know (and
should not know) that a string is expected.

Whereas, it is certainly possible to have the parser guide the scanner, it
introduces complexity and bugs for absolutely no gain in value (either to
the user or the developer). For this reason, most modern languages
(including C) make keywords reserved.

I can understand the concern that this breaks the existing usage. I am
considering allowing the use of C-style strings to overcome this resistance
- even though I am not convinced that doing so is a good idea. See one of my
previous emails for my reasons. I will allow Prof. Mills to have the final
say in the way things will work.

> 2. Right now, the -4 and -6 switches, for DNS zone selection don't work. I
> > wasn't sure why they were needed, but I can put them in later.
> >
> They are needed because we run over both IPv4 and IPv6 and DNS lookups
> will give you back both addresses. Sometimes you don't want the IPv6
> addresses because your network infrastructure. Sometimes, and this is
> more for the future, you only want to deal with IPv6 infrastructures.


Ok, I have resolved this problem.

> Also if anyone has some thoughts on why everything works fine when ntpd is
> > run with the -d switch, but doesn't configure when run without it,
> please
> > let me know. That is the final block preventing me from releasing the
> code
> > into the wild.
> >
>
> That one's obvious. You have something defined within a if(debug) that
> shouldn't be conditional. Since the code is not yet released, we can
> tell you where.


Nope, it had nothing to do with an if (debug) conditional.

The problem was that the daemon() function is being called, with its
arguments nochdir and noclose as 0 and 0 respectively. This results in the
NTP daemon reverting to / as its present working directory. I was giving a
relative path using the -c switch, which meant that it couldn't find the
ntp.conf file that I was referring to.

However, I believe it is brain dead to continue to run and do nothing when
ntpd can't find the configuration file. It should display an error at the
least and hopefully exit gracefully. Also, all parse errors should be
displayed by default. I have been working on NTP for a year now and this
threw me off. Fortunately, I could read the code and figure out what was
happening.

I understand that daemons should go about their work as silently as
possible, especially if they are called through init/rc scripts at startup.
I think we could have a flag that turns on silent mode or we should specify
that all errors will be logged into the system logs.

I'd be happy to receive your and other fellow hacker's comments on this and
any other aspect of the configuration process.

Regards,
Sachin.

-- 
___________________________________
Sachin Kamboj
Computer & Information Sciences
University of Delaware
Homepage: http://www.cis.udel.edu/~kamboj/
___________________________________
Life is a Constraint Satisfaction Problem.


More information about the hackers mailing list