dlz_setclientcallback() for DLZ dlopen() in [was: BIND 9.9.0a3 is now available]

Evan Hunt each at isc.org
Wed Oct 19 17:20:15 UTC 2011


> Apologies, but I can't find what has changed except for a description in
> contrib/dlz/example/dlz_minimal.h, where it says:

My apologies in turn: dlz_minimal.h is wrong.  What you're seeing there is
from an earlier version of the work; I made changes but apparently failed
to commit all of them correctly.  I'll fix it.


To answer the question, there's a sample DLZ driver in
bin/tests/system/dlzexternal/driver.c that demonstrates the new feature.
The dlz_lookup() function now takes two new options: 'methods' and
'clientinfo'.

'methods' contains a pointer to a sourceip() callback function provided by
named (in the future this may be extended to include other callback
functions, such as one to identify the TSIG key that signed the request,
but right now only sourceip() is implemented).

'clientinfo' is an opaque blob of data provided by named that the callback
functions can read to fetch information about the client.  So, to use this
in a DLZ driver:

isc_result_t
dlz_lookup(const char *zone, const char *name, void *dbdata,
           dns_sdlzlookup_t *lookup, dns_clientinfomethods_t *methods,
           dns_clientinfo_t *clientinfo)
{
        isc_sockaddr_t *src = NULL;
        [...]

        if (methods != NULL &&
            methods->version - methods->age >= DNS_CLIENTINFOMETHODS_VERSION)
                methods->sourceip(clientinfo, &src);

        /*
         * At this point, src is either NULL or a pointer to the source
         * IP address of the client.
         */

        [...]
}

-- 
Evan Hunt -- each at isc.org
Internet Systems Consortium, Inc.



More information about the bind-workers mailing list