Skip to content

Commit 90ae6fc

Browse files
AlphixNoltari
authored andcommitted
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: openwrt#350 (cherry picked from commit 6b88c31) Signed-off-by: David Härdeman <david@hardeman.nu> Link: openwrt#351 Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
1 parent 1ff1328 commit 90ae6fc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/statefiles.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ static void statefiles_write_state6(struct write_ctxt *ctxt, struct dhcpv6_lease
488488
fprintf(ctxt->fp,
489489
"# %s %s %x %s%s %" PRId64 " %" PRIx64 " %" PRIu8,
490490
ctxt->iface->ifname, duidbuf, ntohl(lease->iaid),
491-
lease->hostname_valid ? "" : "broken\\x20",
491+
lease->hostname && !lease->hostname_valid ? "broken\\x20": "",
492492
lease->hostname ? lease->hostname : "-",
493493
(lease->valid_until > ctxt->now ?
494494
(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
524524
"# %s %s ipv4 %s%s %" PRId64 " %x 32 %s/32\n",
525525
ctxt->iface->ifname,
526526
ether_ntoa((struct ether_addr *)lease->hwaddr),
527-
lease->hostname_valid ? "" : "broken\\x20",
527+
lease->hostname && !lease->hostname_valid ? "broken\\x20" : "",
528528
lease->hostname ? lease->hostname : "-",
529529
(lease->valid_until > ctxt->now ?
530530
(int64_t)(lease->valid_until - ctxt->now + ctxt->wall_time) :

0 commit comments

Comments
 (0)