[ntp:hackers] Can somebody give me a quick lesson on how the config file parser works?

Harlan Stenn stenn at ntp.org
Tue Aug 12 03:26:26 UTC 2014


Hal Murray writes:

> I'm interested in what happens at run time, not how to build the parser.
> 
> The context is that I had a system with the commands to setup logging
> at the bottom of ntp.conf.  That broke with p457 Moving those lines to
> the top of ntp.conf "fixed" it.

PHK recently did some code cleanup to the parser, but I'm not aware of
anything he might have done that would have caused this.

> Does the order of lines in the config file matter?  If so, why and
> such, and where is that documented?

The only order-dependent lines I'm aware of are with the "interface"
commands.

> I think that area was rewriten/cleaned-up a year or two ago, at least
> in part to add config tweaking via ntpq, including the command to
> write out the current config.  I think part of that read things in,
> fixed up the order, then processed them, as compared to the old way
> that processed things in order as they were read in.

I don't fully recall.  I do know that when we went to the command-line
configuration we made a point of being sure we didn't have to parse the
entire file and then process the result; we wanted to be able to handle
things one line at a time.  We also knew that the order of the
"interface" commands was significant, so we keep that the same.

I'd be curious to see how the file saved by the "saveconfig" differs
based on the location of your logging directives.

H


More information about the hackers mailing list