]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: filters: Exec pre/post analysers only one time per filter
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 20 May 2021 16:00:55 +0000 (18:00 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 21 May 2021 07:59:00 +0000 (09:59 +0200)
For each filter, pre and post callback functions must only be called one
time. To do so, when one of them is finished, the corresponding analyser bit
must be removed from pre_analyzers or post_analyzers bit field. It is only
an issue with pre-analyser callback functions if the corresponding analyser
yields. It may happens with lua action for instance. In this case, the
filters pre analyser callback function is unexpectedly called several times.

This patch should fix the issue #1263. It must be backported is all stable
versions.

src/filters.c

index b684b44da4be61e6421f9b479223024f8581f66e..99b44e06e2695d676a0bf6324300ca677c14cf6d 100644 (file)
@@ -757,6 +757,7 @@ flt_pre_analyze(struct stream *s, struct channel *chn, unsigned int an_bit)
                        ret = FLT_OPS(filter)->channel_pre_analyze(s, filter, chn, an_bit);
                        if (ret <= 0)
                                BREAK_EXECUTION(s, chn, check_result);
+                       filter->pre_analyzers &= ~an_bit;
                }
        } RESUME_FILTER_END;
 
@@ -789,6 +790,7 @@ flt_post_analyze(struct stream *s, struct channel *chn, unsigned int an_bit)
                        ret = FLT_OPS(filter)->channel_post_analyze(s, filter, chn, an_bit);
                        if (ret < 0)
                                break;
+                       filter->post_analyzers &= ~an_bit;
                }
        }
        ret = handle_analyzer_result(s, chn, 0, ret);