From: Christopher Faulet Date: Thu, 4 Jul 2019 09:08:38 +0000 (+0200) Subject: MINOR: action: Add the return code ACT_RET_DONE for actions X-Git-Tag: v2.1-dev1~32 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2e4843d1d200210e0b11fdc71991f089103e2a60;p=thirdparty%2Fhaproxy.git MINOR: action: Add the return code ACT_RET_DONE for actions This code should be now used by action to stop at the same time the rules processing and the possible following processings. And from its side, the return code ACT_RET_STOP should be used to only stop rules processing. So concretely, for TCP rules, there is no changes. ACT_RET_STOP and ACT_RET_DONE are handled the same way. However, for HTTP rules, ACT_RET_STOP should now be mapped on HTTP_RULE_RES_STOP and ACT_RET_DONE on HTTP_RULE_RES_DONE. So this way, a action will have the possibilty to stop all processing or only rules processing. Note that changes about the TCP is done in this commit but changes about the HTTP will be done in another one because it will fix a bug in the same time. This patch must be backported to 2.0 because a bugfix depends on it. --- diff --git a/include/types/action.h b/include/types/action.h index 948e281d7f..54a6f71a4b 100644 --- a/include/types/action.h +++ b/include/types/action.h @@ -41,6 +41,7 @@ enum act_return { ACT_RET_STOP, /* stop processing. */ ACT_RET_YIELD, /* call me again. */ ACT_RET_ERR, /* processing error. */ + ACT_RET_DONE, /* processing done, stop processing */ }; enum act_parse_ret { diff --git a/src/tcp_rules.c b/src/tcp_rules.c index 72b11ae369..d81ffe3a33 100644 --- a/src/tcp_rules.c +++ b/src/tcp_rules.c @@ -242,12 +242,13 @@ resume_execution: case ACT_RET_CONT: continue; case ACT_RET_STOP: + case ACT_RET_DONE: break; case ACT_RET_YIELD: s->current_rule = rule; goto missing_data; } - break; /* ACT_RET_STOP */ + break; /* ACT_RET_STOP/DONE */ } } } @@ -379,13 +380,14 @@ resume_execution: case ACT_RET_CONT: continue; case ACT_RET_STOP: + case ACT_RET_DONE: break; case ACT_RET_YIELD: channel_dont_close(rep); s->current_rule = rule; return 0; } - break; /* ACT_RET_STOP */ + break; /* ACT_RET_STOP/DONE */ } } } @@ -484,6 +486,7 @@ int tcp_exec_l4_rules(struct session *sess) send_log(sess->fe, LOG_WARNING, "Internal error: yield not allowed with tcp-request connection actions."); case ACT_RET_STOP: + case ACT_RET_DONE: break; case ACT_RET_CONT: continue; @@ -491,7 +494,7 @@ int tcp_exec_l4_rules(struct session *sess) result = 0; break; } - break; /* ACT_RET_STOP */ + break; /* ACT_RET_STOP/DONE */ } } } @@ -563,6 +566,7 @@ int tcp_exec_l5_rules(struct session *sess) send_log(sess->fe, LOG_WARNING, "Internal error: yield not allowed with tcp-request session actions."); case ACT_RET_STOP: + case ACT_RET_DONE: break; case ACT_RET_CONT: continue; @@ -570,7 +574,7 @@ int tcp_exec_l5_rules(struct session *sess) result = 0; break; } - break; /* ACT_RET_STOP */ + break; /* ACT_RET_STOP/DONE */ } } }