Skip to content

Commit

Permalink
rpcd-mod-luci: strip colon from dnsmasq duid
Browse files Browse the repository at this point in the history
Dnsmasq DHCPv6 use colons in the generated duid present in the lease file. Strip the colon as this is not supported by the OpenWrt config and follow the same way odhcpd use to display duid.

Fixes: openwrt#4543

Signed-off-by: Ansuel Smith <[email protected]>
  • Loading branch information
Ansuel authored and systemcrash committed Jul 26, 2024
1 parent f488d28 commit f71e9cb
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions libs/rpcd-mod-luci/src/luci.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,15 @@ duid2ea(const char *duid)
return &ea;
}

static void strip_colon_duid(char *str) {
char *pr = str, *pw = str;

while (*pr) {
*pw = *pr++;
pw += (*pw != ':');
}
*pw = '\0';
}

static struct {
time_t now;
Expand Down Expand Up @@ -592,6 +601,8 @@ lease_next(void)
if (!e.hostname || !e.duid)
continue;

strip_colon_duid(e.duid);

if (!strcmp(e.hostname, "*"))
e.hostname = NULL;

Expand Down

0 comments on commit f71e9cb

Please sign in to comment.