Closed mikma closed 2 years ago
Can you squash all the commits into one commit as they're all related to the same feature
I have squashed and rebased on master at git.openwrt.org.
I also added a check against the reserved IPv6 interface identifier ranges listed at http://www.iana.org/assignments/ipv6-interface-ids .
This fails to compile for me with the following error
src/dhcpv6-ia.c: In function 'dhcpv6_ia_write_statefile':
src/dhcpv6-ia.c:367:54: error: format '%zx' expects argument of type 'size_t', but argument 10 has type 'uint64_t' {aka 'long long unsigned int'} [-Werror=format=]
ctxt.buf_idx = snprintf(ctxt.buf, ctxt.buf_len, "# %s %s %x %s%s %"PRId64" %zx %u ",
^~~~~~~
src/dhcpv6-ia.c:374:9:
(ctxt.c->flags & OAF_DHCPV6_NA) ? ctxt.c->assigned_host_id : ctxt.c->assigned_subnet_id,
src/dhcpv6-ia.c:367:83: note: format string is defined here
ctxt.buf_idx = snprintf(ctxt.buf, ctxt.buf_len, "# %s %s %x %s%s %"PRId64" %zx %u ",
~~^
%llx
As assigned_hostìd is an uint64_t the best option is to move this to two separate snprintf lines depending on the assignment type
I have duplicated the snprintf statements and I use the PRIx64/32-macros in the format string now.
Patch pushed to master with a minor modification (https://git.openwrt.org/?p=project/odhcpd.git;a=commit;h=16667699228101fda936068e3d11c0cf19270e34); thx
This PR implements up to 64 bit wide hostid for dynamic and static leases.