2019-03-31 12:49:47 +02:00
|
|
|
.. Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
2021-06-03 08:37:05 +02:00
|
|
|
..
|
2019-03-31 12:49:47 +02:00
|
|
|
.. SPDX-License-Identifier: MPL-2.0
|
2021-06-03 08:37:05 +02:00
|
|
|
..
|
2019-03-31 12:49:47 +02:00
|
|
|
.. This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
.. License, v. 2.0. If a copy of the MPL was not distributed with this
|
2020-09-14 21:04:19 +00:00
|
|
|
.. file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
2021-06-03 08:37:05 +02:00
|
|
|
..
|
2019-03-31 12:49:47 +02:00
|
|
|
.. See the COPYRIGHT file distributed with this work for additional
|
|
|
|
.. information regarding copyright ownership.
|
|
|
|
|
|
|
|
.. _module-info:
|
|
|
|
|
|
|
|
Plugins
|
2022-03-21 22:13:29 +00:00
|
|
|
~~~~~~~
|
2019-03-31 12:49:47 +02:00
|
|
|
|
2022-03-03 22:17:04 +01:00
|
|
|
Plugins are a mechanism to extend the functionality of :iscman:`named` using
|
2019-03-31 12:49:47 +02:00
|
|
|
dynamically loadable libraries. By using plugins, core server
|
|
|
|
functionality can be kept simple for the majority of users; more complex
|
|
|
|
code implementing optional features need only be installed by users that
|
|
|
|
need those features.
|
|
|
|
|
|
|
|
The plugin interface is a work in progress, and is expected to evolve as
|
|
|
|
more plugins are added. Currently, only "query plugins" are supported;
|
|
|
|
these modify the name server query logic. Other plugin types may be
|
|
|
|
added in the future.
|
|
|
|
|
2022-03-03 22:17:04 +01:00
|
|
|
The only plugin currently included in BIND is :iscman:`filter-aaaa.so <filter-aaaa>`, which
|
2019-03-31 12:49:47 +02:00
|
|
|
replaces the ``filter-aaaa`` feature that previously existed natively as
|
2022-03-03 22:17:04 +01:00
|
|
|
part of :iscman:`named`. The code for this feature has been removed from
|
|
|
|
:iscman:`named` and can no longer be configured using standard :iscman:`named.conf`
|
|
|
|
syntax, but linking in the :iscman:`filter-aaaa.so <filter-aaaa>` plugin provides identical
|
2019-03-31 12:49:47 +02:00
|
|
|
functionality.
|
|
|
|
|
|
|
|
Configuring Plugins
|
|
|
|
~~~~~~~~~~~~~~~~~~~
|
2022-05-11 15:45:57 +02:00
|
|
|
.. namedconf:statement:: plugin
|
2022-07-13 19:07:47 +00:00
|
|
|
:tags: server
|
|
|
|
:short: Configures plugins in :iscman:`named.conf`.
|
2019-03-31 12:49:47 +02:00
|
|
|
|
2022-07-01 12:29:18 +02:00
|
|
|
A plugin is configured with the :any:`plugin` statement in :iscman:`named.conf`:
|
2019-03-31 12:49:47 +02:00
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
plugin query "library.so" {
|
|
|
|
parameters
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2025-07-24 10:51:32 +02:00
|
|
|
In this example, ``query`` indicates that this is a query plugin,
|
|
|
|
and ``library.so`` is the name of the plugin library. Note that the
|
|
|
|
library file extension (in this case, ``.so``) is optional, and can
|
|
|
|
be omitted.
|
2019-03-31 12:49:47 +02:00
|
|
|
|
2022-07-01 12:29:18 +02:00
|
|
|
Multiple :any:`plugin` statements can be specified, to load different
|
2019-03-31 12:49:47 +02:00
|
|
|
plugins or multiple instances of the same plugin.
|
|
|
|
|
2020-05-13 21:22:34 +00:00
|
|
|
``parameters`` are passed as an opaque string to the plugin's initialization
|
2020-06-08 15:33:45 +00:00
|
|
|
routine. Configuration syntax differs depending on the module.
|
2019-03-31 12:49:47 +02:00
|
|
|
|
|
|
|
Developing Plugins
|
|
|
|
~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
Each plugin implements four functions:
|
|
|
|
|
2020-06-08 15:33:45 +00:00
|
|
|
- ``plugin_register``
|
2019-03-31 12:49:47 +02:00
|
|
|
to allocate memory, configure a plugin instance, and attach to hook
|
|
|
|
points within
|
2022-03-03 22:17:04 +01:00
|
|
|
:iscman:`named`
|
2019-03-31 12:49:47 +02:00
|
|
|
,
|
2020-06-08 15:33:45 +00:00
|
|
|
- ``plugin_destroy``
|
2019-03-31 12:49:47 +02:00
|
|
|
to tear down the plugin instance and free memory,
|
2020-06-08 15:33:45 +00:00
|
|
|
- ``plugin_version``
|
2019-03-31 12:49:47 +02:00
|
|
|
to check that the plugin is compatible with the current version of
|
|
|
|
the plugin API,
|
2020-06-08 15:33:45 +00:00
|
|
|
- ``plugin_check``
|
2019-03-31 12:49:47 +02:00
|
|
|
to test syntactic correctness of the plugin parameters.
|
|
|
|
|
2022-03-03 22:17:04 +01:00
|
|
|
At various locations within the :iscman:`named` source code, there are "hook
|
2019-03-31 12:49:47 +02:00
|
|
|
points" at which a plugin may register itself. When a hook point is
|
2022-03-03 22:17:04 +01:00
|
|
|
reached while :iscman:`named` is running, it is checked to see whether any
|
2019-03-31 12:49:47 +02:00
|
|
|
plugins have registered themselves there; if so, the associated "hook
|
2020-06-08 15:33:45 +00:00
|
|
|
action" - a function within the plugin library - is called. Hook
|
|
|
|
actions may examine the runtime state and make changes: for example,
|
2019-03-31 12:49:47 +02:00
|
|
|
modifying the answers to be sent back to a client or forcing a query to
|
|
|
|
be aborted. More details can be found in the file
|
|
|
|
``lib/ns/include/ns/hooks.h``.
|