diff options
Diffstat (limited to 'src/config.c')
-rw-r--r-- | src/config.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/config.c b/src/config.c index e631814..5ba4d9e 100644 --- a/src/config.c +++ b/src/config.c @@ -29,7 +29,7 @@ static void lease_update(struct vlist_tree *tree, struct vlist_node *node_new, struct vlist_tree leases = VLIST_TREE_INIT(leases, lease_cmp, lease_update, true, false); AVL_TREE(interfaces, avl_strcmp, false, NULL); struct config config = {.legacy = false, .main_dhcpv4 = false, - .dhcp_cb = NULL, .dhcp_statefile = NULL, + .dhcp_cb = NULL, .dhcp_statefile = NULL, .dhcp_hostsfile = NULL, .log_level = LOG_WARNING}; #define START_DEFAULT 100 @@ -180,6 +180,7 @@ enum { ODHCPD_ATTR_LEASEFILE, ODHCPD_ATTR_LEASETRIGGER, ODHCPD_ATTR_LOGLEVEL, + ODHCPD_ATTR_HOSTSFILE, ODHCPD_ATTR_MAX }; @@ -189,6 +190,7 @@ 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_HOSTSFILE] = { .name = "hostsfile", .type = BLOBMSG_TYPE_STRING }, }; const struct uci_blob_param_list odhcpd_attr_list = { @@ -326,6 +328,11 @@ static void set_config(struct uci_section *s) config.dhcp_statefile = strdup(blobmsg_get_string(c)); } + if ((c = tb[ODHCPD_ATTR_HOSTSFILE])) { + free(config.dhcp_hostsfile); + config.dhcp_hostsfile = strdup(blobmsg_get_string(c)); + } + if ((c = tb[ODHCPD_ATTR_LEASETRIGGER])) { free(config.dhcp_cb); config.dhcp_cb = strdup(blobmsg_get_string(c)); |