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 via email to