Commit 7b71a75c authored by Daniel Salzman's avatar Daniel Salzman

mod-synthetic: rename zone to origin and address to network

parent e772860b
......@@ -616,7 +616,7 @@ Example::
type: forward
prefix: dynamic-
ttl: 400
address: 2620:0:b61::/52
network: 2620:0:b61::/52
zone:
- domain: example.
......@@ -654,9 +654,9 @@ Example::
- id: test2
type: reverse
prefix: dynamic-
zone: example
origin: example
ttl: 400
address: 2620:0:b61::/52
network: 2620:0:b61::/52
zone:
- domain: 1.6.b.0.0.0.0.0.0.2.6.2.ip6.arpa.
......@@ -677,7 +677,7 @@ Limitations
^^^^^^^^^^^
* As of now, there is no authenticated denial of nonexistence (neither
NSEC or NSEC3 is supported) nor DNSSEC signed records. However,
NSEC or NSEC3 is supported) nor DNSSEC signed records. However,
since the module is hooked in the query processing plan, it will be
possible to do online signing in the future.
......
......@@ -758,9 +758,9 @@ mod\-synth\-record:
\- id: STR
type: forward | reverse
prefix: STR
zone: DNAME
origin: DNAME
ttl: INT
address: ADDR[/INT]
network: ADDR[/INT]
.ft P
.fi
.UNINDENT
......@@ -789,9 +789,9 @@ Caution: \fIprefix\fP doesn’t allow dots, address parts in the synthetic names
separated with a dash.
.sp
Default: empty
.SS zone
.SS origin
.sp
A zone name suffix (only valid for \fI\%reverse type\fP).
A zone origin (only valid for \fI\%reverse type\fP).
.sp
Default: empty
.SS ttl
......@@ -799,7 +799,7 @@ Default: empty
Time to live of the generated records.
.sp
Default: 3600
.SS address
.SS network
.sp
A network subnet in the form of \fIaddress/prefix\fP\&.
.sp
......
......@@ -901,9 +901,9 @@ given prefix and subnet.
- id: STR
type: forward | reverse
prefix: STR
zone: DNAME
origin: DNAME
ttl: INT
address: ADDR[/INT]
network: ADDR[/INT]
.. _mod-synth-record_id:
......@@ -938,12 +938,12 @@ separated with a dash.
Default: empty
.. _mod-synth-record_zone:
.. _mod-synth-record_origin:
zone
----
origin
------
A zone name suffix (only valid for :ref:`reverse type<mod-synth-record_type>`).
A zone origin (only valid for :ref:`reverse type<mod-synth-record_type>`).
Default: empty
......@@ -956,9 +956,9 @@ Time to live of the generated records.
Default: 3600
.. _mod-synth-record_address:
.. _mod-synth-record_network:
address
network
-------
A network subnet in the form of *address/prefix*.
......
......@@ -23,11 +23,11 @@
#include "libknot/descriptor.h"
/* Module configuration scheme. */
#define MOD_ADDR "\x07""address"
#define MOD_NET "\x07""network"
#define MOD_ORIGIN "\x06""origin"
#define MOD_PREFIX "\x06""prefix"
#define MOD_TTL "\x03""ttl"
#define MOD_TYPE "\x04""type"
#define MOD_ZONE "\x04""zone"
/*! \brief Supported answer synthesis template types. */
enum synth_template_type {
......@@ -42,7 +42,7 @@ static const lookup_table_t synthetic_types[] = {
{ 0, NULL }
};
static int check_zone(
static int check_origin(
conf_args_t *args)
{
conf_val_t val = { NULL };
......@@ -53,7 +53,7 @@ static int check_zone(
return val.code;
}
// Only reverse module can have a zone specified.
// Only reverse module can have an origin specified.
if (conf_opt(&val) != SYNTH_REVERSE) {
return KNOT_EINVAL;
}
......@@ -65,9 +65,9 @@ const yp_item_t scheme_mod_synth_record[] = {
{ C_ID, YP_TSTR, YP_VNONE },
{ MOD_TYPE, YP_TOPT, YP_VOPT = { synthetic_types, SYNTH_NULL } },
{ MOD_PREFIX, YP_TSTR, YP_VNONE },
{ MOD_ZONE, YP_TDNAME, YP_VNONE, YP_FNONE, { check_zone } },
{ MOD_ORIGIN, YP_TDNAME, YP_VNONE, YP_FNONE, { check_origin } },
{ MOD_TTL, YP_TINT, YP_VINT = { 0, UINT32_MAX, 3600, YP_STIME } },
{ MOD_ADDR, YP_TNET, YP_VNONE },
{ MOD_NET, YP_TNET, YP_VNONE },
{ C_COMMENT, YP_TSTR, YP_VNONE },
{ NULL }
};
......@@ -413,12 +413,12 @@ int synth_record_load(struct query_plan *plan, struct query_module *self)
}
tpl->prefix = strdup(prefix);
/* Set zone if generating reverse record. */
/* Set origin if generating reverse record. */
if (tpl->type == SYNTH_REVERSE) {
val = conf_mod_get(self->config, MOD_ZONE, self->id);
val = conf_mod_get(self->config, MOD_ORIGIN, self->id);
if (val.code != KNOT_EOK) {
if (val.code == KNOT_EINVAL) {
MODULE_ERR("no zone for '%s'", self->id->data);
MODULE_ERR("no origin for '%s'", self->id->data);
}
free(tpl->prefix);
mm_free(self->mm, tpl);
......@@ -448,10 +448,10 @@ int synth_record_load(struct query_plan *plan, struct query_module *self)
tpl->ttl = conf_int(&val);
/* Set address. */
val = conf_mod_get(self->config, MOD_ADDR, self->id);
val = conf_mod_get(self->config, MOD_NET, self->id);
if (val.code != KNOT_EOK) {
if (val.code == KNOT_EINVAL) {
MODULE_ERR("no address for '%s'", self->id->data);
MODULE_ERR("no network for '%s'", self->id->data);
}
free(tpl->zone);
free(tpl->prefix);
......
......@@ -48,13 +48,13 @@ class ModSynthRecord(KnotModule):
src_name = "synth_record_load"
conf_name = "mod-synth-record"
def __init__(self, mtype, prefix, ttl, address, zone=None):
def __init__(self, mtype, prefix, ttl, network, origin=None):
super().__init__()
self.mtype = mtype
self.prefix = prefix
self.ttl = ttl
self.address = address
self.zone = zone
self.network = network
self.origin = origin
def get_conf(self, conf=None):
if not conf:
......@@ -65,9 +65,9 @@ class ModSynthRecord(KnotModule):
conf.item_str("type", self.mtype)
conf.item_str("prefix", self.prefix)
conf.item_str("ttl", self.ttl)
conf.item_str("address", self.address)
if (self.zone):
conf.item_str("zone", self.zone)
conf.item_str("network", self.network)
if (self.origin):
conf.item_str("origin", self.origin)
conf.end()
return conf
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment