l = (struct list *)&curproxy->tcpcheck_rules;
if (l->p != l->n) {
tcpcheck = (struct tcpcheck_rule *)l->n;
- while (tcpcheck->action == TCPCHK_ACT_COMMENT) {
+ while (&tcpcheck->list != &curproxy->tcpcheck_rules &&
+ tcpcheck->action == TCPCHK_ACT_COMMENT) {
tcpcheck = (struct tcpcheck_rule *)tcpcheck->list.n;
}
- /* we've reached the end of the list, and the list is full of comments */
- if (tcpcheck == (struct tcpcheck_rule *)l)
- tcpcheck = NULL;
- if (tcpcheck && tcpcheck->action != TCPCHK_ACT_CONNECT) {
+ if (&tcpcheck->list != &curproxy->tcpcheck_rules
+ && tcpcheck->action != TCPCHK_ACT_CONNECT) {
Alert("parsing [%s:%d] : first step MUST also be a 'connect' when there is a 'connect' step in the tcp-check ruleset.\n",
file, linenum);
err_code |= ERR_ALERT | ERR_FATAL;
next = (struct tcpcheck_rule *)check->current_step->list.n;
/* bypass all comment rules */
- while (next->action == TCPCHK_ACT_COMMENT)
+ while (&next->list != head && next->action == TCPCHK_ACT_COMMENT)
next = (struct tcpcheck_rule *)next->list.n;
/* NULL if we're on the last rule */
check->current_step = (struct tcpcheck_rule *)check->current_step->list.n;
/* bypass all comment rules */
- while (check->current_step->action == TCPCHK_ACT_COMMENT)
+ while (&check->current_step->list != head &&
+ check->current_step->action == TCPCHK_ACT_COMMENT)
check->current_step = (struct tcpcheck_rule *)check->current_step->list.n;
+ if (&check->current_step->list == head)
+ break;
+
/* don't do anything until the connection is established */
if (!(conn->flags & CO_FL_CONNECTED)) {
/* update expire time, should be done by process_chk */
check->current_step = (struct tcpcheck_rule *)check->current_step->list.n;
/* bypass all comment rules */
- while (check->current_step->action == TCPCHK_ACT_COMMENT)
+ while (&check->current_step->list != head &&
+ check->current_step->action == TCPCHK_ACT_COMMENT)
check->current_step = (struct tcpcheck_rule *)check->current_step->list.n;
+
+ if (&check->current_step->list == head)
+ break;
} /* end 'send' */
else if (check->current_step->action == TCPCHK_ACT_EXPECT) {
if (unlikely(check->result == CHK_RES_FAILED))
check->current_step = (struct tcpcheck_rule *)check->current_step->list.n;
/* bypass all comment rules */
- while (check->current_step->action == TCPCHK_ACT_COMMENT)
+ while (&check->current_step->list != head &&
+ check->current_step->action == TCPCHK_ACT_COMMENT)
check->current_step = (struct tcpcheck_rule *)check->current_step->list.n;
+ if (&check->current_step->list == head)
+ break;
+
if (check->current_step->action == TCPCHK_ACT_EXPECT)
goto tcpcheck_expect;
__conn_data_stop_recv(conn);
check->current_step = (struct tcpcheck_rule *)check->current_step->list.n;
/* bypass all comment rules */
- while (check->current_step->action == TCPCHK_ACT_COMMENT)
+ while (&check->current_step->list != head &&
+ check->current_step->action == TCPCHK_ACT_COMMENT)
check->current_step = (struct tcpcheck_rule *)check->current_step->list.n;
+ if (&check->current_step->list == head)
+ break;
+
if (check->current_step->action == TCPCHK_ACT_EXPECT)
goto tcpcheck_expect;
__conn_data_stop_recv(conn);