[bind10-dev] CCSession question

Tomek Mrugalski tomasz at isc.org
Thu Sep 27 15:44:20 UTC 2012


On 27.09.2012 08:55, Michal 'vorner' Vaner wrote:
> On Wed, Sep 26, 2012 at 07:51:30PM +0200, Tomek Mrugalski wrote:
>> The problem occurs, when I stop and start bind10. As soon as I
>> create ModuleCCSession(), it will call my config_handler, but
>> will pass only part of the configuration (without any fields that
>> have default values). In this particular example, I receive
>> only:
>> 
>> { "subnet6": [ { "pool": [ "2001:db8:1::1 - 2001:db8:1::ffff" ], 
>> "subnet": "2001:db8:1::/64" } ] }
>> 
>> My parser does not know values of renew-timer, so I can't really 
>> configure subnets.
> 
> Reading all the above, I was wondering if you're aiming to this
> problem or some other the whole time. I was right :-)).
> 
> What I usually do is ignore the parameter of the callback and
> request the whole config by getFullConfig (I hope I remember the
> name of the function right) to parse.
I've looked at all instances of getFullConfig() calls in our
production code. There are two of them: auth and resolver. I use
exactly the same approach in dhcp6, but you missed my point. My
problem is that the ModuleCCSession calls my callback from its
constructor, before I even get a pointer to ModuleCCSession object, so
I don't have any way to call getFullConfig().

Right now I use a dirty trick to ignore that config (a simple flags
called ignore_configs is set to true for the early phase of
bootstrapping). Once ModuleCCSession is created, I then clear the
ignore_configs flag and pass results of getFullConfig() to my
callback. It works, but is ugly and a bit annoying.

I would very much prefer if ModuleCCSession wouldn't send me the
configuration before I'm ready to receive it. Is the ModuleCCSession
constructor supposed to send me configuration, even if I set
start_immediately to false? In my opinion the condition in
ModuleCCSession() constructor should be changed from:

 if (config_handler_) {

to

 if (config_handler_ && start_immediately) {

Alternatively, extra parameter should be added to the constructor
(something like dont_send_config_immediately ) in case
start_immediately means something else than I think it means.

> Other option is having the defaults hardcoded in the code and check
> if the value is present, schematically like this:
No, that would be just a kludge to work around problems in CCSession
code. I very much prefer to improve the way configuration is handled,
rather than develop something that will be difficult to maintain. So I
agree with your comment that it is not good way forward.

Tomek



More information about the bind10-dev mailing list