]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: action: Add the return code ACT_RET_DONE for actions
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 4 Jul 2019 09:08:38 +0000 (11:08 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 5 Jul 2019 12:26:14 +0000 (14:26 +0200)
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.

include/types/action.h
src/tcp_rules.c

index 948e281d7fcb0fbe11e3970749d9ca3eed7d87e3..54a6f71a4b050fffe57c7d0c6bcb50c4604cd741 100644 (file)
@@ -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 {
index 72b11ae369559064c76231966b8d19d9dba56937..d81ffe3a33ef9406f256db6f4420cac299fe48c2 100644 (file)
@@ -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 */
                        }
                }
        }