confd: fix mDNS service type generation

In the 34fa6a3 refactor we lost announcement of mDNS completely:

 - The type of all services was set to 'all', instead of, e.g., _ssh._tcp
 - The web console service was not added properly
 - Web services for plain HTTP/HTTPS were not created at all

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2024-04-30 15:51:17 +02:00
committed by Tobias Waldekranz
parent 3f87945f75
commit dee36ce801
+3 -3
View File
@@ -87,7 +87,7 @@ static int mdns_records(const char *cmd, svc type)
snprintf(buf, sizeof(buf), srv->text, hostname);
systemf("/usr/libexec/confd/gen-service %s %s %s %s %d \"%s\" %s", cmd,
hostname, srv->name, name[type], srv->port, srv->desc, buf);
hostname, srv->name, srv->type, srv->port, srv->desc, buf);
}
return SR_ERR_OK;
@@ -165,7 +165,7 @@ static void svc_enadis(int ena, svc type, const char *svc)
}
if (type != none)
mdns_records(ena ? "" : "delete", type);
mdns_records(ena ? "add" : "delete", type);
systemf("initctl -nbq touch avahi");
systemf("initctl -nbq touch nginx");
@@ -285,7 +285,7 @@ static int web_change(sr_session_ctx_t *session, uint32_t sub_id, const char *mo
svc_enadis(0, netbrowse, NULL);
}
svc_enadis(ena, none, "nginx"); /* fake it, not nginx .conf */
svc_enadis(ena, web, "nginx");
mdns_cname(session);
return put(cfg, srv);