diff options
author | Ansuel Smith <ansuelsmth@gmail.com> | 2020-12-07 17:57:49 +0100 |
---|---|---|
committer | Paul Donald <newtwen+github@gmail.com> | 2024-07-26 02:13:46 +0200 |
commit | f71e9cbd42db24c7743589804dacfdf5513ca883 (patch) | |
tree | 28ac1d44fb554ea0b717659660e69aa1d8b508e8 | |
parent | f488d2865358edfaf27cba7f5d0f8d7c150dcf97 (diff) |
rpcd-mod-luci: strip colon from dnsmasq duid
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: #4543
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
-rw-r--r-- | libs/rpcd-mod-luci/src/luci.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libs/rpcd-mod-luci/src/luci.c b/libs/rpcd-mod-luci/src/luci.c index 8b56dce6b7..d9e2ab79ce 100644 --- a/libs/rpcd-mod-luci/src/luci.c +++ b/libs/rpcd-mod-luci/src/luci.c @@ -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; @@ -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; |