* Forward declarations of functions referenced in install_hooks().
*/
static ns_hookresult_t
-filter_qctx_initialize(void *arg, void *cbdata, isc_result_t *resp);
+filter_initialize(void *arg, void *cbdata, isc_result_t *resp);
static ns_hookresult_t
filter_respond_begin(void *arg, void *cbdata, isc_result_t *resp);
static ns_hookresult_t
install_hooks(ns_hooktable_t *hooktable, isc_mem_t *mctx,
filter_instance_t *inst) {
const ns_hook_t filter_init = {
- .action = filter_qctx_initialize,
+ .action = filter_initialize,
.action_data = inst,
};
};
ns_hook_add(hooktable, mctx, NS_QUERY_QCTX_INITIALIZED, &filter_init);
+ ns_hook_add(hooktable, mctx, NS_QUERY_AUTHZONE_ATTACHED, &filter_init);
ns_hook_add(hooktable, mctx, NS_QUERY_RESPOND_BEGIN, &filter_respbegin);
ns_hook_add(hooktable, mctx, NS_QUERY_RESPOND_ANY_FOUND,
&filter_respanyfound);
* in a hash table keyed according to the client object; this enables us to
* retrieve persistent data related to a client query for as long as the
* object persists.
+ *
+ * Whether the plugin is registered at view level and the server makes authority
+ * on zones, this can be called twice (once when the query context is
+ * initialized, once when the authoritative zone is found). This is all fine:
+ * the state will be initialized on the first call, and the function bails off
+ * early on the second call (the state is already initialized).
*/
static ns_hookresult_t
-filter_qctx_initialize(void *arg, void *cbdata, isc_result_t *resp) {
+filter_initialize(void *arg, void *cbdata, isc_result_t *resp) {
query_ctx_t *qctx = (query_ctx_t *)arg;
filter_instance_t *inst = (filter_instance_t *)cbdata;
filter_data_t *client_state;
* Forward declarations of functions referenced in install_hooks().
*/
static ns_hookresult_t
-filter_qctx_initialize(void *arg, void *cbdata, isc_result_t *resp);
+filter_initialize(void *arg, void *cbdata, isc_result_t *resp);
static ns_hookresult_t
filter_respond_begin(void *arg, void *cbdata, isc_result_t *resp);
static ns_hookresult_t
install_hooks(ns_hooktable_t *hooktable, isc_mem_t *mctx,
filter_instance_t *inst) {
const ns_hook_t filter_init = {
- .action = filter_qctx_initialize,
+ .action = filter_initialize,
.action_data = inst,
};
};
ns_hook_add(hooktable, mctx, NS_QUERY_QCTX_INITIALIZED, &filter_init);
+ ns_hook_add(hooktable, mctx, NS_QUERY_AUTHZONE_ATTACHED, &filter_init);
ns_hook_add(hooktable, mctx, NS_QUERY_RESPOND_BEGIN, &filter_respbegin);
ns_hook_add(hooktable, mctx, NS_QUERY_RESPOND_ANY_FOUND,
&filter_respanyfound);
* in a hash table keyed according to the client object; this enables us to
* retrieve persistent data related to a client query for as long as the
* object persists.
+ *
+ * Whether the plugin is registered at view level and the server makes authority
+ * on zones, this can be called twice (once when the query context is
+ * initialized, once when the authoritative zone is found). This is all fine:
+ * the state will be initialized on the first call, and the function bails off
+ * early on the second call (the state is already initialized).
*/
static ns_hookresult_t
-filter_qctx_initialize(void *arg, void *cbdata, isc_result_t *resp) {
+filter_initialize(void *arg, void *cbdata, isc_result_t *resp) {
query_ctx_t *qctx = (query_ctx_t *)arg;
filter_instance_t *inst = (filter_instance_t *)cbdata;
filter_data_t *client_state;
};
{% if family == "v6" %}
- plugin query "@TOP_BUILDDIR@/filter-@filtertype@.@DYLIB@" {
- filter-@filtertype@-on-v6 break-dnssec;
- filter-@filtertype@ { fd92:7065:b8e:ffff::4; };
- };
+ plugin query "@TOP_BUILDDIR@/filter-@filtertype@.@DYLIB@" {
+ filter-@filtertype@-on-v6 break-dnssec;
+ filter-@filtertype@ { fd92:7065:b8e:ffff::4; };
+ };
{% else %}
- plugin query "@TOP_BUILDDIR@/filter-@filtertype@.@DYLIB@" {
- filter-@filtertype@-on-v4 break-dnssec;
- filter-@filtertype@ { 10.53.0.4; };
- };
+ plugin query "@TOP_BUILDDIR@/filter-@filtertype@.@DYLIB@" {
+ filter-@filtertype@-on-v4 break-dnssec;
+ filter-@filtertype@ { 10.53.0.4; };
+ };
{% endif %}
key rndc_key {
};
zone "." { type primary; file "root.db"; };
-zone "signed" { type primary; file "signed.db.signed"; };
-zone "unsigned" { type primary; file "unsigned.db"; };
+
+zone "signed" {
+ type primary;
+ file "signed.db.signed";
+ {% if family == "v6" %}
+ plugin query "@TOP_BUILDDIR@/filter-@filtertype@.@DYLIB@" {
+ filter-@filtertype@-on-v6 break-dnssec;
+ filter-@filtertype@ { fd92:7065:b8e:ffff::4; };
+ };
+ {% else %}
+ plugin query "@TOP_BUILDDIR@/filter-@filtertype@.@DYLIB@" {
+ filter-@filtertype@-on-v4 break-dnssec;
+ filter-@filtertype@ { 10.53.0.4; };
+ };
+ {% endif %}
+};
+
+zone "unsigned" {
+ type primary;
+ file "unsigned.db";
+ {% if family == "v6" %}
+ plugin query "@TOP_BUILDDIR@/filter-@filtertype@.@DYLIB@" {
+ filter-@filtertype@-on-v6 break-dnssec;
+ filter-@filtertype@ { fd92:7065:b8e:ffff::4; };
+ };
+ {% else %}
+ plugin query "@TOP_BUILDDIR@/filter-@filtertype@.@DYLIB@" {
+ filter-@filtertype@-on-v4 break-dnssec;
+ filter-@filtertype@ { 10.53.0.4; };
+ };
+ {% endif %}
+};