Re: relayd: expose backup role of relay tables to relayctl

Rafael Sadowski <[email protected]>
Newsgroups gmane.os.openbsd.tech
Message-ID <[email protected]>
On Sun Aug 09, 2026 at 09:34:09PM +0200, Kirill A. Korinsky wrote:
> On Sat, 08 Aug 2026 14:50:05 +0200,
> Rafael Sadowski <[email protected]> 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?

No you're not wrong. That never worked, but now that "backup" is out,
it's obviously not necessary.

> 
> > commit 18b5909ffabbe72603ac927c0550ada83b2cc817
> > Author: Rafael Sadowski <[email protected]>
> > 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
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.