relayd http check fix

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

relayd http check fix

Rivo Nurges-2
Hi!

If relayd http check doesn't get any answer to its http check it marks
backend host as up.

host x.y.z, check http code (2010ms,tcp read timeout), state down ->
up, availability 14.29%

sample config:
relay test {
  listen on x.x.x.x port 9999
  forward to <test> port 9999 check http "/" code 200
}

sample server:
while :;do nc -l 9999;done

fix:
Index: usr.sbin/relayd/check_tcp.c
===================================================================
RCS file: /cvs/src/usr.sbin/relayd/check_tcp.c,v
retrieving revision 1.55
diff -u -p -r1.55 check_tcp.c
--- usr.sbin/relayd/check_tcp.c 4 Jul 2017 20:27:09 -0000 1.55
+++ usr.sbin/relayd/check_tcp.c 28 Mar 2018 16:45:38 -0000
@@ -243,8 +243,10 @@ tcp_read_buf(int s, short event, void *a
  if (event == EV_TIMEOUT) {
  if (ibuf_size(cte->buf))
  (void)cte->validate_close(cte);
- else
+ else {
  cte->host->he = HCE_TCP_READ_TIMEOUT;
+ cte->host->up = HOST_DOWN;
+ }
  tcp_close(cte, cte->host->up == HOST_UP ? 0 : HOST_DOWN);
  hce_notify_done(cte->host, cte->host->he);
  return;

Reply | Threaded
Open this post in threaded view
|

Re: relayd http check fix

Rivo Nurges-2
Hi!

ping

Rivo

On Wed, 2018-03-28 at 16:56 +0000, Rivo Nurges wrote:

> Hi!
>
> If relayd http check doesn't get any answer to its http check it
> marks
> backend host as up.
>
> host x.y.z, check http code (2010ms,tcp read timeout), state down ->
> up, availability 14.29%
>
> sample config:
> relay test {
>   listen on x.x.x.x port 9999
>   forward to <test> port 9999 check http "/" code 200
> }
>
> sample server:
> while :;do nc -l 9999;done
>
> fix:
> Index: usr.sbin/relayd/check_tcp.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/relayd/check_tcp.c,v
> retrieving revision 1.55
> diff -u -p -r1.55 check_tcp.c
> --- usr.sbin/relayd/check_tcp.c 4 Jul 2017 20:27:09 -0000
> 1.55
> +++ usr.sbin/relayd/check_tcp.c 28 Mar 2018 16:45:38 -0000
> @@ -243,8 +243,10 @@ tcp_read_buf(int s, short event, void *a
>   if (event == EV_TIMEOUT) {
>   if (ibuf_size(cte->buf))
>   (void)cte->validate_close(cte);
> - else
> + else {
>   cte->host->he = HCE_TCP_READ_TIMEOUT;
> + cte->host->up = HOST_DOWN;
> + }
>   tcp_close(cte, cte->host->up == HOST_UP ? 0 :
> HOST_DOWN);
>   hce_notify_done(cte->host, cte->host->he);
>   return;
>

Reply | Threaded
Open this post in threaded view
|

Re: relayd http check fix

Sebastian Benoit-3
Rivo Nurges([hidden email]) on 2018.04.06 10:44:20 +0000:
> Hi!
>
> ping
>
> Rivo

thanks for reminding me, and thanks for the diff.
committed.

/Benno
 

> On Wed, 2018-03-28 at 16:56 +0000, Rivo Nurges wrote:
> > Hi!
> >
> > If relayd http check doesn't get any answer to its http check it
> > marks
> > backend host as up.
> >
> > host x.y.z, check http code (2010ms,tcp read timeout), state down ->
> > up, availability 14.29%
> >
> > sample config:
> > relay test {
> >   listen on x.x.x.x port 9999
> >   forward to <test> port 9999 check http "/" code 200
> > }
> >
> > sample server:
> > while :;do nc -l 9999;done
> >
> > fix:
> > Index: usr.sbin/relayd/check_tcp.c
> > ===================================================================
> > RCS file: /cvs/src/usr.sbin/relayd/check_tcp.c,v
> > retrieving revision 1.55
> > diff -u -p -r1.55 check_tcp.c
> > --- usr.sbin/relayd/check_tcp.c 4 Jul 2017 20:27:09 -0000
> > 1.55
> > +++ usr.sbin/relayd/check_tcp.c 28 Mar 2018 16:45:38 -0000
> > @@ -243,8 +243,10 @@ tcp_read_buf(int s, short event, void *a
> >   if (event == EV_TIMEOUT) {
> >   if (ibuf_size(cte->buf))
> >   (void)cte->validate_close(cte);
> > - else
> > + else {
> >   cte->host->he = HCE_TCP_READ_TIMEOUT;
> > + cte->host->up = HOST_DOWN;
> > + }
> >   tcp_close(cte, cte->host->up == HOST_UP ? 0 :
> > HOST_DOWN);
> >   hce_notify_done(cte->host, cte->host->he);
> >   return;
> >
>