From 2455a48e2bff0ae887ef3a81496db1b37a46eae0 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Tue, 30 Mar 2021 02:59:02 +0200 Subject: 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.) --- src/config.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/config.c') 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) { -- cgit v1.2.3