network: fix writing domain suffix to hosts file
authorFelix Fietkau <nbd@nbd.name>
Tue, 23 Aug 2022 21:37:27 +0000 (23:37 +0200)
committerFelix Fietkau <nbd@nbd.name>
Tue, 23 Aug 2022 21:37:27 +0000 (23:37 +0200)
Signed-off-by: Felix Fietkau <nbd@nbd.name>
main.c

diff --git a/main.c b/main.c
index c9ce132a2cfa616d88f92c619cfd9d2b5cec4c14..9926ecdc3e47e821632dd00e49b93ddc69e1256d 100644 (file)
--- a/main.c
+++ b/main.c
@@ -32,7 +32,9 @@ network_write_hosts(struct network *net, FILE *f)
 
        avl_for_each_element(&net->hosts, host, node) {
                inet_ntop(AF_INET6, &host->peer.local_addr, ip, sizeof(ip));
-               fprintf(f, "%s\t%s\n", ip, network_host_name(host));
+               fprintf(f, "%s\t%s%s%s\n", ip, network_host_name(host),
+                       net->config.domain ? "." : "",
+                       net->config.domain ? net->config.domain : "");
        }
 }