rndc changezone

Klaus Darilion klaus.mailinglists at pernau.at
Tue Jul 8 20:14:43 UTC 2014


Am 08.07.2014 20:16, schrieb Evan Hunt:
> On Tue, Jul 08, 2014 at 06:53:34PM +0200, Klaus Darilion wrote:
>> I try to implement a "rndc changezone" which allows me to change the
>> config of a zone which was added with "rndc addzone".
> Cool!  I had actually started work on "rndc editzone" myself, but hadn't
> gotten far yet.  If you'd be willing to contribute your patch, I'd love to
> see it.

So I should have waited :-)

Sure I would contribute the patch - if I succeed.
>
>> I greped the code for "delzone" and "addzone" and added my code to the
>> same places. rndc accepts the new option but bind named refuses the
>> command with:
>>    named[13052]: unknown option 'changezone'
>>
>> I suspect there may be some sort of dictionary somewhere, where the
>> whole arguments are parsed (all parameters after "rndc") - but I fail to
>> find it. Any hints are appreciated.
> The commands themselves are checked in ns_control_docommand() in
> bin/named/control.c, and the functions that implement the commands are
> mostly implemented in bin/named/server.c.

I found the problem: I had to extend "lib/isccfg/namedconf.c":
static cfg_clausedef_t
addzoneconf_clauses[] = {
         { "addzone", &cfg_type_addzone, 0 },
+        { "changezone", &cfg_type_addzone, 0 },
         { NULL, NULL, 0 }
};


The next question is, how to tell named that the zone has a new config. 
I reused the addzone code. addzone calls configure_zone(). The comment 
above configure_zone() says:
    "* Configure or reconfigure a zone."

Thus I thought I could just call this function and it will update the 
zone inside named, but I failed. The function exits with:

   named[22880]: none:1: zone 'test.at' already exists

Thus, can I reuse this function to update the zone? Actually is it 
possible to update the zone or do I have to delete and re-add it? How 
does "rndc reconfig" update the zone?

Thanks
Klaus





More information about the bind-workers mailing list