Index | Thread | Search

From:
Kirill A. Korinsky <kirill@korins.ky>
Subject:
Re: relayd: macros are only expanded for append and set
To:
Rafael Sadowski <rafael@sizeofvoid.org>
Cc:
tech@openbsd.org
Date:
Tue, 20 Oct 2026 23:11:02 +0200

Download raw body.

Thread
On Fri, 09 Oct 2026 18:58:42 +0200,
Rafael Sadowski <rafael@sizeofvoid.org> wrote:
> 
> 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?
>

OK kirill@

> 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;
> 

-- 
wbr, Kirill