summaryrefslogtreecommitdiffhomepage
path: root/src/config.c
diff options
context:
space:
mode:
authorMikael Magnusson <mikma@users.sourceforge.net>2021-03-30 02:59:02 +0200
committerMikael Magnusson <mikma@users.sourceforge.net>2021-09-21 22:22:04 +0200
commit2455a48e2bff0ae887ef3a81496db1b37a46eae0 (patch)
tree21408a305f3e550701af7141bba102e575059e28 /src/config.c
parent01b4e6046f10e21809c3f380f2d33bf3fe59698d (diff)
dhcpv6-ia: implement prng using md5 from libubus
Include the following parameters in the hash calculation: DUID, IAID, counter and secret key. (IA-type is always IA_NA and is not included.)
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/config.c b/src/config.c
index 71b786c..bbac334 100644
--- a/src/config.c
+++ b/src/config.c
@@ -172,6 +172,7 @@ enum {
ODHCPD_ATTR_LEASEFILE,
ODHCPD_ATTR_LEASETRIGGER,
ODHCPD_ATTR_LOGLEVEL,
+ ODHCPD_ATTR_SECRETKEY,
ODHCPD_ATTR_MAX
};
@@ -181,6 +182,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_SECRETKEY] = { .name = "secretkey", .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)
setlogmask(LOG_UPTO(config.log_level));
}
}
+
+ if ((c = tb[ODHCPD_ATTR_SECRETKEY])) {
+ free(config.secret_key);
+ config.secret_key = strdup(blobmsg_get_string(c));
+ }
}
static double parse_leasetime(struct blob_attr *c) {