Index | Thread | Search

From:
Kirill A. Korinsky <kirill@korins.ky>
Subject:
Re: relayd: expose backup role of relay tables to relayctl
To:
Rafael Sadowski <rafael@sizeofvoid.org>
Cc:
tech@openbsd.org
Date:
Sun, 09 Aug 2026 21:34:09 +0200

Download raw body.

Thread
On Sat, 08 Aug 2026 14:50:05 +0200,
Rafael Sadowski <rafael@sizeofvoid.org> wrote:
> 
> Since I haven't received an OK for my manpage diff yet, and the
> situation with the backup tables is extremely unclear, here's a first
> step.
> 
> I would like to make it transparent for users what is marked as backup
> table. Here is an example with a modified relayctl call:
> 
> doas relayctl -v show summary
> Id   Type   Name                     Avlblty Checks   Status
> 1    relay  https-gateway                             active
> 1    table  wiki:3000                                 active (1 hosts)
> 1    host   10.0.23.6                100.00% 1/1      up
> 2    table  ap:6443                                   backup active (1 hosts)
> 2    host   10.0.23.6                100.00% 1/1      up
> 
> OK?
>

It conflicts with https://marc.info/?l=openbsd-tech&m=178628460482427&w=2

Am I wrong?

> commit 18b5909ffabbe72603ac927c0550ada83b2cc817
> Author: Rafael Sadowski <rafael@sizeofvoid.org>
> Date:   Sat Aug 1 21:14:53 2026 +0200
> 
>     relayd: expose backup role of relay tables to relayctl
>     
>     F_BACKUP lives on the relay_table binding (rlt_flags), not on the table itself,
>     because one table can be primary for one relay and backup for another. As a
>     result IMSG_CTL_TABLE from pfe never carried the backup role, and relayctl
>     always displayed backup tables as plain active.
>     
>     Send a copy of the table when reporting status and mark it as backup if the
>     binding says so. The shared table stays untouched and all other flags are
>     preserved.
> 
> diff --git a/pfe.c b/pfe.c
> index 1438171..5b89fa9 100644
> --- a/pfe.c
> +++ b/pfe.c
> @@ -409,8 +409,13 @@ relays:
>  		    &rlay->rl_stats, sizeof(rlay->rl_stats));
>  
>  		TAILQ_FOREACH(rlt, &rlay->rl_tables, rlt_entry) {
> +			struct table	 tbl = *rlt->rlt_table;
> +
> +			/* Backup role lives on rlt_flags; expose it. */
> +			if (rlt->rlt_flags & F_BACKUP)
> +				tbl.conf.flags |= F_BACKUP;
>  			imsg_compose_event(&c->iev, IMSG_CTL_TABLE, 0, 0, -1,
> -			    rlt->rlt_table, sizeof(*rlt->rlt_table));
> +			    &tbl, sizeof(tbl));
>  			if (!(rlt->rlt_table->conf.flags & F_DISABLE))
>  				TAILQ_FOREACH(host,
>  				    &rlt->rlt_table->hosts, entry)
> 

-- 
wbr, Kirill