Index | Thread | Search

From:
Rafael Sadowski <rafael@sizeofvoid.org>
Subject:
relayd: reclassify log levels
To:
tech@openbsd.org
Date:
Thu, 5 Nov 2026 21:04:34 +0100

Download raw body.

Thread
OK?

commit 7bdd895e0ef8ce3d5b2c8bbc4ec3a431cc454375
Author: Rafael Sadowski <rafael@sizeofvoid.org>
Date:   Tue Nov 3 22:04:19 2026 +0100

    relayd: reclassify log levels
    
    Some messages do not set errno, so they correspond to log_warnx rather
    than warn. Some debug messages are actually warnings, others are simply
    informational.

diff --git a/ca.c b/ca.c
index beb86d5..a6e28b5 100644
--- a/ca.c
+++ b/ca.c
@@ -259,7 +259,7 @@ ca_dispatch_relay(int fd, struct privsep_proc *p, struct imsg *imsg)
 			if (proc_composev_imsg(env->sc_ps, PROC_RELAY,
 			    cko.cko_proc, imsg_get_type(imsg), -1, -1, iov,
 			    c) == -1)
-				log_warn("%s: proc_composev_imsg", __func__);
+				log_warnx("%s: proc_composev_imsg", __func__);
 			break;
 		}
 
@@ -298,7 +298,7 @@ ca_dispatch_relay(int fd, struct privsep_proc *p, struct imsg *imsg)
 
 		if (proc_composev_imsg(env->sc_ps, PROC_RELAY, cko.cko_proc,
 		    imsg_get_type(imsg), -1, -1, iov, c) == -1)
-			log_warn("%s: proc_composev_imsg", __func__);
+			log_warnx("%s: proc_composev_imsg", __func__);
 
 		free(to);
 		RSA_free(rsa);
@@ -330,7 +330,7 @@ ca_dispatch_relay(int fd, struct privsep_proc *p, struct imsg *imsg)
 			if (proc_composev_imsg(env->sc_ps, PROC_RELAY,
 			    cko.cko_proc, imsg_get_type(imsg), -1, -1, iov,
 			    c) == -1)
-				log_warn("%s: proc_composev_imsg", __func__);
+				log_warnx("%s: proc_composev_imsg", __func__);
 			break;
 		}
 
@@ -354,7 +354,7 @@ ca_dispatch_relay(int fd, struct privsep_proc *p, struct imsg *imsg)
 
 		if (proc_composev_imsg(env->sc_ps, PROC_RELAY, cko.cko_proc,
 		    imsg_get_type(imsg), -1, -1, iov, c) == -1)
-			log_warn("%s: proc_composev_imsg", __func__);
+			log_warnx("%s: proc_composev_imsg", __func__);
 
 		free(to);
 		EC_KEY_free(ecdsa);
@@ -418,11 +418,11 @@ rsae_send_imsg(int flen, const u_char *from, u_char *to, RSA *rsa,
 	 * operation in OpenSSL.
 	 */
 	if (imsg_composev(imsgbuf, cmd, 0, 0, -1, iov, cnt) == -1) {
-		log_warn("%s: imsg_composev", __func__);
+		log_warnx("%s: imsg_composev", __func__);
 		return -1;
 	}
 	if (imsgbuf_flush(imsgbuf) == -1) {
-		log_warn("%s: imsgbuf_flush", __func__);
+		log_warnx("%s: imsgbuf_flush", __func__);
 		return -1;
 	}
 
@@ -611,11 +611,11 @@ ecdsae_send_enc_imsg(const unsigned char *dgst, int dgst_len,
 	 */
 	if (imsg_composev(imsgbuf, IMSG_CA_ECDSA_SIGN, 0, 0, -1, iov, cnt) ==
 	    -1) {
-		log_warn("%s: imsg_composev", __func__);
+		log_warnx("%s: imsg_composev", __func__);
 		return (NULL);
 	}
 	if (imsgbuf_flush(imsgbuf) == -1) {
-		log_warn("%s: imsgbuf_flush", __func__);
+		log_warnx("%s: imsgbuf_flush", __func__);
 		return (NULL);
 	}
 
diff --git a/check_icmp.c b/check_icmp.c
index 46d01fa..81dfc2c 100644
--- a/check_icmp.c
+++ b/check_icmp.c
@@ -309,7 +309,7 @@ recv_icmp(int s, short event, void *arg)
 	    (struct sockaddr *)&ss, &slen);
 	if (r == -1 || r != ICMP_BUF_SIZE) {
 		if (r == -1 && errno != EAGAIN && errno != EINTR)
-			log_debug("%s: receive error", __func__);
+			log_warn("%s: receive error", __func__);
 		goto retry;
 	}
 
diff --git a/check_script.c b/check_script.c
index d5bd70f..eedc96c 100644
--- a/check_script.c
+++ b/check_script.c
@@ -106,7 +106,7 @@ script_exec(struct relayd *env, struct ctl_script *scr)
 		return (-1);
 	}
 
-	log_debug("%s: running script %s, host %s",
+	log_info("%s: running script %s, host %s",
 	    __func__, scr->path, scr->name);
 
 	arg = scr->name;
diff --git a/check_tls.c b/check_tls.c
index 37c4c7e..a6a9bff 100644
--- a/check_tls.c
+++ b/check_tls.c
@@ -206,7 +206,7 @@ check_tls_cleanup(struct ctl_tcp_event *cte)
 void
 check_tls_error(struct ctl_tcp_event *cte, const char *where, const char *what)
 {
-	log_debug("TLS error: %s: %s: %s", where, what, tls_error(cte->tls));
+	log_warnx("TLS error: %s: %s: %s", where, what, tls_error(cte->tls));
 }
 
 void
diff --git a/hce.c b/hce.c
index b9cd490..2ea431b 100644
--- a/hce.c
+++ b/hce.c
@@ -224,7 +224,7 @@ hce_notify_done(struct host *host, enum host_error he)
 	host->he = he;
 
 	if (host->up == HOST_DOWN && host->retry_cnt) {
-		log_debug("%s: host %s retry %d", __func__,
+		log_info("%s: host %s retry %d", __func__,
 		    host->conf.name, host->retry_cnt);
 		host->up = host->last_up;
 		host->retry_cnt--;
diff --git a/parse.y b/parse.y
index e666082..6d2f60c 100644
--- a/parse.y
+++ b/parse.y
@@ -3277,7 +3277,7 @@ load_config(const char *filename, struct relayd *x_conf)
 	for (sym = TAILQ_FIRST(&symhead); sym != NULL; sym = next) {
 		next = TAILQ_NEXT(sym, entry);
 		if (!sym->used)
-			log_debug("warning: macro '%s' not used", sym->nam);
+			log_info("macro '%s' not used", sym->nam);
 		if (!sym->persist) {
 			free(sym->nam);
 			free(sym->val);
diff --git a/pfe.c b/pfe.c
index 4c42cf4..4acbbcc 100644
--- a/pfe.c
+++ b/pfe.c
@@ -579,7 +579,7 @@ disable_table(struct ctl_conn *c, struct ctl_id *id)
 	    &table->conf.id, sizeof(table->conf.id)) == -1)
 		log_warn("%s: proc_compose", __func__);
 
-	log_debug("%s: table %d", __func__, table->conf.id);
+	log_info("table %s disabled", table->conf.name);
 	pfe_sync();
 	return (0);
 }
@@ -617,7 +617,7 @@ enable_table(struct ctl_conn *c, struct ctl_id *id)
 	    &table->conf.id, sizeof(table->conf.id)) == -1)
 		log_warn("%s: proc_compose", __func__);
 
-	log_debug("%s: table %d", __func__, table->conf.id);
+	log_info("table %s enabled", table->conf.name);
 	pfe_sync();
 	return (0);
 }
@@ -666,7 +666,7 @@ disable_host(struct ctl_conn *c, struct ctl_id *id, struct host *host)
 	    &host->conf.id, sizeof(host->conf.id)) == -1)
 		log_warn("%s: proc_compose", __func__);
 
-	log_debug("%s: host %d", __func__, host->conf.id);
+	log_info("host %s disabled", host->conf.name);
 
 	if (!host->conf.parentid) {
 		/* Disable all children */
@@ -722,7 +722,7 @@ enable_host(struct ctl_conn *c, struct ctl_id *id, struct host *host)
 	    &host->conf.id, sizeof(host->conf.id)) == -1)
 		log_warn("%s: proc_compose", __func__);
 
-	log_debug("%s: host %d", __func__, host->conf.id);
+	log_info("host %s enabled", host->conf.name);
 
 	if (!host->conf.parentid) {
 		/* Enable all children */
diff --git a/pfe_filter.c b/pfe_filter.c
index c02d13c..51969c1 100644
--- a/pfe_filter.c
+++ b/pfe_filter.c
@@ -583,7 +583,7 @@ natlook(struct relayd *env, struct ctl_natlook *cnl)
 		pnl.direction = PF_OUT;
 		cnl->in = 0;
 		if (ioctl(env->sc_pf->dev, DIOCNATLOOK, &pnl) == -1) {
-			log_debug("%s: ioctl: %s", __func__, strerror(errno));
+			log_warnx("%s: ioctl: %s", __func__, strerror(errno));
 			return (-1);
 		}
 	}
diff --git a/pfe_route.c b/pfe_route.c
index 49c2f4b..cd91a5f 100644
--- a/pfe_route.c
+++ b/pfe_route.c
@@ -196,7 +196,7 @@ pfe_route(struct relayd *env, struct ctl_netroute *crt)
 	return (0);
 
  bad:
-	log_debug("%s: failed to %s gateway %s: %d %s", __func__,
+	log_warnx("%s: failed to %s gateway %s: %d %s", __func__,
 	    HOST_ISUP(crt->up) ? "add" : "delete", gwname,
 	    errno, strerror(errno));
 
diff --git a/relay.c b/relay.c
index 1f28ccd..42a56a3 100644
--- a/relay.c
+++ b/relay.c
@@ -486,7 +486,7 @@ relay_launch(void)
 			break;
 		}
 
-		log_debug("%s: running relay %s", __func__,
+		log_info("%s: running relay %s", __func__,
 		    rlay->rl_conf.name);
 
 		rlay->rl_up = HOST_UP;
@@ -974,7 +974,7 @@ relay_splice(struct ctl_relay_event *cre)
 	sp.sp_max = cre->toread > 0 ? cre->toread : 0;
 	bcopy(&rlay->rl_conf.timeout, &sp.sp_idle, sizeof(sp.sp_idle));
 	if (setsockopt(cre->s, SOL_SOCKET, SO_SPLICE, &sp, sizeof(sp)) == -1) {
-		log_debug("%s: session %d: splice dir %d failed: %s",
+		log_warnx("%s: session %d: splice dir %d failed: %s",
 		    __func__, con->se_id, cre->dir, strerror(errno));
 		return (-1);
 	}
@@ -999,7 +999,7 @@ relay_splicelen(struct ctl_relay_event *cre)
 
 	optlen = sizeof(len);
 	if (getsockopt(cre->s, SOL_SOCKET, SO_SPLICE, &len, &optlen) == -1) {
-		log_debug("%s: session %d: splice dir %d get length failed: %s",
+		log_warnx("%s: session %d: splice dir %d get length failed: %s",
 		    __func__, con->se_id, cre->dir, strerror(errno));
 		return (-1);
 	}
@@ -1325,7 +1325,7 @@ relay_from_table(struct rsession *con)
 
  gottable:
 	if (table == NULL) {
-		log_debug("%s: session %d: no active hosts",
+		log_warnx("%s: session %d: no active hosts",
 		    __func__, con->se_id);
 		return (-1);
 	}
@@ -1582,7 +1582,7 @@ relay_connect_retry(int fd, short sig, void *arg)
 		if (errno == ENFILE || errno == EMFILE)
 			log_warn("%s: session %d: deferring forward",
 			    __func__, con->se_id);
-		log_debug("%s: session %d: "
+		log_warnx("%s: session %d: "
 		    "forward failed: %s, %s", __func__,
 		    con->se_id, strerror(errno),
 		    con->se_retry ? "next retry" : "last retry");
@@ -1651,7 +1651,7 @@ relay_connect(struct rsession *con)
 	if ((rlay->rl_conf.flags & F_TLSINSPECT) &&
 	    con->se_out.state == STATE_PRECONNECT) {
 		if (con->se_out.tls == NULL) {
-			log_debug("%s: tls connect failed", __func__);
+			log_warnx("%s: tls connect failed", __func__);
 			return (-1);
 		}
 		relay_connected(con->se_out.s, EV_WRITE, con);
@@ -1678,7 +1678,7 @@ relay_connect(struct rsession *con)
 
 	if (rlay->rl_conf.fwdmode == FWD_TRANS) {
 		if (con->se_bnds == -1) {
-			log_debug("%s: could not bind any sock", __func__);
+			log_warnx("%s: could not bind any sock", __func__);
 			return (-1);
 		}
 		bnds = con->se_bnds;
@@ -1695,7 +1695,7 @@ relay_connect(struct rsession *con)
 		else
 			ret = 0;
 		if (ret != 0) {
-			log_debug("%s: mapped to invalid address", __func__);
+			log_warnx("%s: mapped to invalid address", __func__);
 			return (-1);
 		}
 	}
@@ -1718,14 +1718,14 @@ relay_connect(struct rsession *con)
 		} else {
 			if (con->se_retry) {
 				con->se_retry--;
-				log_debug("%s: session %d: "
+				log_warnx("%s: session %d: "
 				    "forward failed: %s, %s", __func__,
 				    con->se_id, strerror(errno),
 				    con->se_retry ?
 				    "next retry" : "last retry");
 				goto retry;
 			}
-			log_debug("%s: session %d: forward failed: %s",
+			log_warnx("%s: session %d: forward failed: %s",
 			    __func__, con->se_id, strerror(errno));
 			return (-1);
 		}
diff --git a/relayd.c b/relayd.c
index 9121f26..bcf5414 100644
--- a/relayd.c
+++ b/relayd.c
@@ -397,6 +397,7 @@ parent_configure_done(struct relayd *env)
 			    0) == -1)
 				fatal("%s: proc_compose", __func__);
 		}
+		log_info("configuration reloaded");
 	}
 }