About Bind Plugin development

Chunhui Ouyang jack9603301 at 163.com
Sat Nov 22 12:00:08 UTC 2025


This is a client requirement, so I don't intend to open-source it directly, nor would there be any point, as it's a special, non-standard implementation. It will filter DNS resolution requests and match the IP record of any domain name against a given list; if a match is found, it will force the return of the given IP. Therefore, I need to write a separate plugin.

I'm hoping to find a solution so I can set up the plugin's compilation code within a separate project, or, if it must be compiled within the bind's source tree, please tell me how to set up the code tree and write the Makefile code to guide the compilation?

* Ondřej Surý <ondrej at isc.org> [2025-11-22 :46:40]:

> Sure, if you want to use BIND 9 headers than you need to use all the headers, including config.h and then it is probably easier to add your plugin to the BIND 9 source tree.
> 
> Is your plugin under compatible open source license? If yes, we can take a look, and help.
> 
> Or perhaps you might start by describing what is your plugin meant for. There might be existing solution for this.
> 
> Ondrej
> --
> Ondřej Surý — ISC (He/Him)
> 
> My working hours and your working hours may be different. Please do not feel obligated to reply outside your normal working hours.
> 
> > On 22. 11. 2025, at 12:40, Chunhui Ouyang <jack9603301 at 163.com> wrote:
> > 
> > Strangely, if I don't use config.h, I get a whole bunch of compilation errors, such as:
> > 
> > ```
> > gcc -shared -fPIC -I /root/bind-project/lib/isc/include/ -I /root/bind-project/bind/lib/isccfg/include/ -I /root/bind-project/bind/lib/ns/include/ main.c -o filter-plugin.so
> > In file included from /usr/include/isc/quota.h:34,
> >                 from /root/bind-project/bind/lib/ns/include/ns/client.h:65,
> >                 from main.c:15:
> > /usr/include/isc/job.h:40:38: error: field ‘wfcq_node’ has incomplete type
> >   40 |                 struct cds_wfcq_node wfcq_node;
> >      |                                      ^~~~~~~~~
> > In file included from /usr/include/isc/mutex.h:24,
> >                 from /usr/include/isc/mem.h:23,
> >                 from /usr/include/isc/buffer.h:112,
> >                 from main.c:5:
> > /usr/include/isc/quota.h:59:1: error: invalid application of ‘sizeof’ to incomplete type ‘struct __cds_wfcq_head’
> >   59 | STATIC_ASSERT(ISC_OS_CACHELINE_SIZE >= sizeof(struct __cds_wfcq_head),
> >      | ^~~~~~~~~~~~~
> > /usr/include/isc/quota.h:59:15: error: expression in static assertion is not an integer
> >   59 | STATIC_ASSERT(ISC_OS_CACHELINE_SIZE >= sizeof(struct __cds_wfcq_head),
> >      |               ^~~~~~~~~~~~~~~~~~~~~
> > /usr/include/isc/quota.h:68:38: error: field ‘head’ has incomplete type
> >   68 |                 struct cds_wfcq_head head;
> >      |                                      ^~~~
> > /usr/include/isc/quota.h:70:47: error: invalid application of ‘sizeof’ to incomplete type ‘struct __cds_wfcq_head’
> >   70 |                                        sizeof(struct __cds_wfcq_head)];
> >      |                                               ^~~~~~
> > /usr/include/isc/quota.h:71:38: error: field ‘tail’ has incomplete type
> >   71 |                 struct cds_wfcq_tail tail;
> >      |                                      ^~~~
> > In file included from /root/bind-project/bind/lib/ns/include/ns/client.h:68:
> > /usr/include/dns/db.h:234:33: error: field ‘rcu_head’ has incomplete type
> >  234 |         struct rcu_head         rcu_head;
> >      |                                 ^~~~~~~~
> > make: *** [Makefile:11: filter-plugin.so] Error 1
> > ```
> > 
> > * Ondřej Surý <ondrej at isc.org> [2025-11-22 :32:13]:
> > 
> >> We don’t guidelines for out of tree plugins, but you should not need config.h from the build. The plugin just need to export the needed symbols.
> >> 
> >> You can contribute these guidelines (or more plugin hooks if needed), this is open source after all…
> >> 
> >> Ondrej
> >> --
> >> Ondřej Surý — ISC (He/Him)
> >> 
> >> My working hours and your working hours may be different. Please do not feel obligated to reply outside your normal working hours.
> >> 
> >>>> On 22. 11. 2025, at 11:51, Chunhui Ouyang <jack9603301 at 163.com> wrote:
> >>> 
> >>> Hello, could you provide a guide on how to organize the project structure for third-party plugin development? I've noticed that current compilation requires the already built bind9's config.h file, but this file doesn't exist in a brand new project. Does this mean it doesn't allow external compilation of the source code?
> >>> 
> >>> Looking forward to your reply.
> >>> 
> >>> * Colin Vidal <colin at isc.org> [2025-11-21 :14:06]:
> >>> 
> >>>>> On Fri, 2025-11-21 at 23:29 +0800, Chunhui Ouyang wrote:
> >>>>> Could you tell me what the entry point of the plugin is?
> >>>>> 
> >>>> 
> >>>> As explained in the reference for plugin development I sent you
> >>>> earlier:
> >>>> 
> >>>> "At various locations within the named source code, there are "hook
> >>>> points" at which a plugin may register itself. When a hook point is
> >>>> reached while named is running, it is checked to see whether any
> >>>> plugins have registered themselves there; if so, the associated "hook
> >>>> action" - a function within the plugin library - is called."
> >>>> 
> >>>> So there is no really a single "entry" point, but rather multiples ones
> >>>> depending where the plugin is hooked. (Plus the four `plugin_*` API to
> >>>> implement for registering, etc.)
> >>>> 
> >>>> Side note: please answer emails with the mailing list in CC, so
> >>>> everyone can see, benefit and contribute to this thread.
> >>>> 
> >>>> Thanks
> >>>> 
> >>>> Colin Vidal
> >>>> 
> >>> --
> >>> Visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe from this list.
> >>> <signature.asc>
> >> 
> > <signature.asc>
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.isc.org/pipermail/bind-users/attachments/20251122/51674bb7/attachment.sig>


More information about the bind-users mailing list