From dee36ce8016ae1f0b00a96811b365fab4eb80939 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Mon, 29 Apr 2024 13:01:36 +0200 Subject: [PATCH] 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 --- src/confd/src/infix-services.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/confd/src/infix-services.c b/src/confd/src/infix-services.c index edcbd2a2..23c7f64a 100644 --- a/src/confd/src/infix-services.c +++ b/src/confd/src/infix-services.c @@ -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);