X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fodhcpd.git;a=blobdiff_plain;f=src%2Fconfig.c;h=068d1a7483a14cba591ec0dd3c1fdbd852e484c1;hp=db5ca3b1772f04d4318e5e81f5cd757e1483be7b;hb=82f3096351911d8c4f3b38e7a5bbeaf75938b6b8;hpb=fc7fb637811089b4f26fb00ca81a0d05c09076bd diff --git a/src/config.c b/src/config.c index db5ca3b..068d1a7 100644 --- a/src/config.c +++ b/src/config.c @@ -255,10 +255,12 @@ static int set_lease(struct uci_section *s) lease->duid_len = len; } - if ((c = tb[LEASE_ATTR_HOSTID])) - if (odhcpd_unhexlify((uint8_t*)&lease->hostid, sizeof(lease->hostid), - blobmsg_get_string(c)) < 0) + if ((c = tb[LEASE_ATTR_HOSTID])) { + errno = 0; + lease->hostid = strtoul(blobmsg_get_string(c), NULL, 16); + if (errno) goto err; + } list_add(&lease->head, &leases); return 0; @@ -447,7 +449,13 @@ int config_parse_interface(void *data, size_t len, const char *name, bool overwr continue; uint8_t buf[256]; - int len = dn_comp(blobmsg_get_string(cur), buf, sizeof(buf), NULL, NULL); + char *domain = blobmsg_get_string(cur); + size_t domainlen = strlen(domain); + if (domainlen > 0 && domain[domainlen - 1] == '.') + domain[domainlen - 1] = 0; + + int len = dn_comp(domain, buf, sizeof(buf), NULL, NULL); + free(domain); if (len <= 0) goto err;