summaryrefslogtreecommitdiffhomepage
path: root/src/config.c
diff options
context:
space:
mode:
authorMikael Magnusson <mikma@users.sourceforge.net>2021-08-15 11:51:22 +0200
committerMikael Magnusson <mikma@users.sourceforge.net>2021-09-21 22:37:08 +0200
commit8d777d12186bb6d5dc4c39e5ccbe50a164ea547c (patch)
tree593cee5bd1a6cb7c485bcafab343c04e51e77563 /src/config.c
parent01b4e6046f10e21809c3f380f2d33bf3fe59698d (diff)
WIP dnsupdatednsupdate
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/config.c b/src/config.c
index 71b786c..dc0722e 100644
--- a/src/config.c
+++ b/src/config.c
@@ -172,6 +172,10 @@ enum {
ODHCPD_ATTR_LEASEFILE,
ODHCPD_ATTR_LEASETRIGGER,
ODHCPD_ATTR_LOGLEVEL,
+ ODHCPD_ATTR_NSUPDATE_DOMAIN,
+ ODHCPD_ATTR_NSUPDATE_KEY,
+ ODHCPD_ATTR_NSUPDATE_SERVER,
+ ODHCPD_ATTR_NSUPDATE_ZONE,
ODHCPD_ATTR_MAX
};
@@ -181,6 +185,10 @@ static const struct blobmsg_policy odhcpd_attrs[ODHCPD_ATTR_MAX] = {
[ODHCPD_ATTR_LEASEFILE] = { .name = "leasefile", .type = BLOBMSG_TYPE_STRING },
[ODHCPD_ATTR_LEASETRIGGER] = { .name = "leasetrigger", .type = BLOBMSG_TYPE_STRING },
[ODHCPD_ATTR_LOGLEVEL] = { .name = "loglevel", .type = BLOBMSG_TYPE_INT32 },
+ [ODHCPD_ATTR_NSUPDATE_DOMAIN] = { .name = "nsupdate_domain", .type = BLOBMSG_TYPE_STRING },
+ [ODHCPD_ATTR_NSUPDATE_KEY] = { .name = "nsupdate_key", .type = BLOBMSG_TYPE_STRING },
+ [ODHCPD_ATTR_NSUPDATE_SERVER] = { .name = "nsupdate_server", .type = BLOBMSG_TYPE_STRING },
+ [ODHCPD_ATTR_NSUPDATE_ZONE] = { .name = "nsupdate_zone", .type = BLOBMSG_TYPE_STRING },
};
const struct uci_blob_param_list odhcpd_attr_list = {
@@ -326,6 +334,26 @@ static void set_config(struct uci_section *s)
setlogmask(LOG_UPTO(config.log_level));
}
}
+
+ if ((c = tb[ODHCPD_ATTR_NSUPDATE_DOMAIN])) {
+ free(config.nsupdate_domain);
+ config.nsupdate_domain = strdup(blobmsg_get_string(c));
+ }
+
+ if ((c = tb[ODHCPD_ATTR_NSUPDATE_KEY])) {
+ free(config.nsupdate_key);
+ config.nsupdate_key = strdup(blobmsg_get_string(c));
+ }
+
+ if ((c = tb[ODHCPD_ATTR_NSUPDATE_SERVER])) {
+ free(config.nsupdate_server);
+ config.nsupdate_server = strdup(blobmsg_get_string(c));
+ }
+
+ if ((c = tb[ODHCPD_ATTR_NSUPDATE_ZONE])) {
+ free(config.nsupdate_zone);
+ config.nsupdate_zone = strdup(blobmsg_get_string(c));
+ }
}
static double parse_leasetime(struct blob_attr *c) {
@@ -1210,6 +1238,8 @@ void odhcpd_reload(void)
uci_unload(uci, dhcp);
uci_free_context(uci);
+
+ dns_reload();
}
static void handle_signal(int signal)
@@ -1234,6 +1264,7 @@ static struct uloop_fd reload_fd = { .fd = -1, .cb = reload_cb };
void odhcpd_run(void)
{
+ syslog(LOG_DEBUG, "odhcpd_run");
if (pipe2(reload_pipe, O_NONBLOCK | O_CLOEXEC) < 0) {}
reload_fd.fd = reload_pipe[0];
@@ -1248,6 +1279,9 @@ void odhcpd_run(void)
sleep(1);
#endif
+ syslog(LOG_DEBUG, "pre dns_init");
+ dns_init();
+ syslog(LOG_DEBUG, "after dns_init");
odhcpd_reload();
uloop_run();
}