Index | Thread | Search

From:
Rafael Sadowski <rafael@sizeofvoid.org>
Subject:
relayd: macros are only expanded for append and set
To:
tech@openbsd.org
Date:
Fri, 9 Oct 2026 18:58:42 +0200

Download raw body.

Thread
I'm working on macro processing to bring it closer to the parser. We
don't need that in the hot path.

I've noticed that, according to the man page, macros are only expanded
for the keywords "append" and "set".

OK?

diff --git a/relayd.c b/relayd.c
index 1c3f682..4c29a7f 100644
--- a/relayd.c
+++ b/relayd.c
@@ -999,7 +999,9 @@ rule_add(struct protocol *proto, struct relay_rule *rule, const char *rulefile)
 		}
 
 		/* Only auto-detect on the side that is not a pattern. */
-		if (kv->kv_value != NULL &&
+		if ((kv->kv_option == KEY_OPTION_APPEND ||
+		    kv->kv_option == KEY_OPTION_SET) &&
+		    kv->kv_value != NULL &&
 		    !(kv->kv_flags & KV_FLAG_VAL_PATTERN) &&
 		    strchr(kv->kv_value, '$') != NULL)
 			kv->kv_flags |= KV_FLAG_MACRO;