]> git.kaiwu.me - haproxy.git/commitdiff
DEBUG: stconn: Add a BUG_ON on shut flags when the endpoint is shut
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 9 Jun 2026 08:44:59 +0000 (10:44 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 15 Jun 2026 06:55:56 +0000 (08:55 +0200)
Whne the endpoint is shut (an applet or a mux), at least one of the SHW
flags must be set (SE_SHW_SILENT or SE_SHW_NORMAL). It is mandatory for
muxes to perform the shutdown. Otherwise, the shutdown could be ignored.

So let's add a BUG_ON() on it to be sure this never happen.

src/stconn.c

index c2f96a198f554404e36c8dbab82deb8a2e84cf97..3015ebbaaaa62a776a3ca716aac7c3384ff6bf85 100644 (file)
@@ -91,6 +91,9 @@ void se_shutdown(struct sedesc *sedesc, enum se_shut_mode mode)
        struct se_abort_info *reason = NULL;
        unsigned int flags = 0;
 
+       /* Should never happen, placed here to be sure we forgot nothing */
+       BUG_ON(!(mode & (SE_SHW_SILENT|SE_SHW_NORMAL)));
+
        if ((mode & (SE_SHW_SILENT|SE_SHW_NORMAL)) && !se_fl_test(sedesc, SE_FL_SHW)) {
                se_report_term_evt(sedesc, se_tevt_type_shutw);
                flags |= (mode & SE_SHW_NORMAL) ? SE_FL_SHWN : SE_FL_SHWS;