diff options
| author | David Härdeman | 2025-12-13 15:07:41 +0000 |
|---|---|---|
| committer | Álvaro Fernández Rojas | 2025-12-14 08:29:04 +0000 |
| commit | 90ae6fc6e478ee6b18ab201275d93817fb5259a5 (patch) | |
| tree | a493e1692991876eb5a3fc9e41eb901f994f517c | |
| parent | 1ff1328a4fc1baca2e0040fe84ca4664dbca69d7 (diff) | |
| download | odhcpd-90ae6fc6e478ee6b18ab201275d93817fb5259a5.tar.gz | |
statefiles: don't consider no hostname as broken
Commit e568bde changed the OAF_BROKEN_HOSTNAME flag to a boolean, but at
the same time changed the semantics slightly so that no hostname was
also considered broken (rather, no hostname means it's neither valid nor
invalid).
So, add a simple fix for this.
Closes: https://github.com/openwrt/odhcpd/issues/350
(cherry picked from commit 6b88c314a59ed9e69c872512a036a592c56730b7)
Signed-off-by: David Härdeman <david@hardeman.nu>
Link: https://github.com/openwrt/odhcpd/pull/351
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
| -rw-r--r-- | src/statefiles.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/statefiles.c b/src/statefiles.c index 558b012..05c9663 100644 --- a/src/statefiles.c +++ b/src/statefiles.c @@ -488,7 +488,7 @@ static void statefiles_write_state6(struct write_ctxt *ctxt, struct dhcpv6_lease fprintf(ctxt->fp, "# %s %s %x %s%s %" PRId64 " %" PRIx64 " %" PRIu8, ctxt->iface->ifname, duidbuf, ntohl(lease->iaid), - lease->hostname_valid ? "" : "broken\\x20", + lease->hostname && !lease->hostname_valid ? "broken\\x20": "", lease->hostname ? lease->hostname : "-", (lease->valid_until > ctxt->now ? (int64_t)(lease->valid_until - ctxt->now + ctxt->wall_time) : @@ -524,7 +524,7 @@ static void statefiles_write_state4(struct write_ctxt *ctxt, struct dhcpv4_lease "# %s %s ipv4 %s%s %" PRId64 " %x 32 %s/32\n", ctxt->iface->ifname, ether_ntoa((struct ether_addr *)lease->hwaddr), - lease->hostname_valid ? "" : "broken\\x20", + lease->hostname && !lease->hostname_valid ? "broken\\x20" : "", lease->hostname ? lease->hostname : "-", (lease->valid_until > ctxt->now ? (int64_t)(lease->valid_until - ctxt->now + ctxt->wall_time) : |