[Pdns-dev] Help with Bison parser for BIND named.conf (allow-query)

Dean Anderson dean at av8.com
Wed Oct 10 00:26:41 CEST 2007


'Compilers' by Aho, Ulhman is the book to learn about compilers and in
particular, parser generators for LALR(1) grammars.  yacc, bison, and
lemon all generate parsers that accept LALR(1) grammars, which are a
slight bit different from generic ebnf syntax used to specify languages.
Most people can write the ebnf grammar for the language they want, but
can't correctly translate that into an LALR(1) grammar which the parser
generator uses. Aho and Ulhman will clear things up.

The Bison docs assume you already have some background in parser
generators, and experience with yacc. The yacc docs are worse. And
lemon, while the best, smallest of all, and with no memory leaks,
doesn't hardly have any docs, either.

Orielly (I think) made a book "Lex and Yacc" that was good. But I think
it might be out of print. I haven't seen it in a while.

		--Dean

On Tue, 9 Oct 2007, Brendan Oakley wrote:

> Hello,
> 
> I have successfully written a patch for the BIND backend which
> restricts queries based on a list of "allowed" subnets, in the same
> way the dnsproxy enforces such restrictions. But I am completely
> unfamiliar with Bison, and I do not find it as easy as advertised, so
> I really do not know how to go about parsing the allow-query parameter
> in the named.conf. Is it possible someone could help me do this? I am
> only necessarily interested in finding it in the context of a
> particular zone, for example:
> 
> zone "secretsubnet.mydomain.com" in {
>      type master;
>      file "/var/named/secretsubnet.mydomain.com";
>      allow-query {
>                           123.456.789.0/24;
>                           10.0.0.0/8;
>                           };
>      };
> 
> I was hoping to use the masters parser as an example to base it on,
> but I just do not understand how it goes together, and the Bison docs
> are too general. I hope such an open-ended request for help is not too
> unreasonable.
> 
> Thanks.
> Brendan
> _______________________________________________
> Pdns-dev mailing list
> Pdns-dev at mailman.powerdns.com
> http://mailman.powerdns.com/mailman/listinfo/pdns-dev
> 
> 

-- 
Av8 Internet   Prepared to pay a premium for better service?
www.av8.net         faster, more reliable, better service
617 344 9000   




More information about the Pdns-dev mailing list