From: Laurent Cimon Subject: Re: relayd patch: allow http relays to have fallback tables To: tech@openbsd.org Date: Tue, 21 Jan 2025 10:09:12 -0500 HAS THIS EVER HAPPENED TO YOU? "I think I'll add a fallback table for when the host is down" table { 127.0.0.1 } table { 127.0.0.1 } log state changes log connection http protocol "proto" { match header log "Host" match url log pass request header "Host" value "localhost" forward to pass request header "Host" value "localhost" forward to } relay "proxy" { listen on lo port 80 protocol "proto" forward to port 8086 forward to port 4243 check tcp } _____________________________ < WHY DOESN'T THIS FALLBACK?? > ----------------------------- \ , , \ /( )` \ \ \___ / | /- _ `-/ ' (/\/ \ \ /\ / / | ` \ O O ) / | `-^--'`< ' (_.) _ ) / `.___/` / `-----' / <----. __ / __ \ <----|====O)))==) \) /==== <----' `--' `.__,' \ | | \ / ______( (_ / \______ ,' ,-----' | \ `--{__________) \/ We can help! With this FREE patch, you can easily use fallback tables with filtered HTTP relays and they will work just like with other relays and redirects! Just as the manpage specifies! Don't let manpage incoherence get to you! Call 1-800-PATCHME that is 1-800-PATCHME Call NOW! (don't call this number) On 1/1/25 21:19, Laurent Cimon wrote: > Hi, > > Currently, relayd does not use fallback tables in an http relay > when there are matching filter rules. This is because it sets the > table before relay_from_table is called. > > This small patch skips the goto when the table is down, allowing it > to search through the table list. > > Wishing you all a good year, > Laurent > > diff --git usr.sbin/relayd/relay.c usr.sbin/relayd/relay.c > index 6d0970802c5..c7837acd4e0 100644 > --- usr.sbin/relayd/relay.c > +++ usr.sbin/relayd/relay.c > @@ -1289,9 +1289,12 @@ relay_from_table(struct rsession *con) > if (con->se_table != NULL) { > rlt = con->se_table; > table = rlt->rlt_table; > + > + /* if the table is not up, continue searching */ > if (table->conf.check && !table->up) > table = NULL; > - goto gottable; > + else > + goto gottable; > } > > /* otherwise grep the first active table */ >