]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: listener: get rid of LI_O_TCP_L4_RULES and LI_O_TCP_L5_RULES
authorWilly Tarreau <w@1wt.eu>
Thu, 12 Jan 2023 19:03:38 +0000 (20:03 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 3 Feb 2023 17:00:20 +0000 (18:00 +0100)
LI_O_TCP_L4_RULES and LI_O_TCP_L5_RULES are only set by from the proxy
based on the presence or absence of tcp_req l4/l5 rules. It's basically
as cheap to check the list as it is to check the flag, except that there
is no need to maintain a copy. Let's get rid of them, and this may ease
addition of more dynamic stuff later.

include/haproxy/listener-t.h
src/cfgparse.c
src/session.c

index 7f0b28603e13423242eff9936c296e2d7dafe438..763e8c37649c5a09d5737feb30bec709932a1aa5 100644 (file)
@@ -96,8 +96,8 @@ enum li_status {
 /* unused                       0x0002  */
 /* unused                       0x0004  */
 /* unused                       0x0008  */
-#define LI_O_TCP_L4_RULES       0x0010  /* run TCP L4 rules checks on the incoming connection */
-#define LI_O_TCP_L5_RULES       0x0020  /* run TCP L5 rules checks on the incoming session */
+/* unused                       0x0010  */
+/* unused                       0x0020  */
 /* unused                       0x0040  */
 /* unused                       0x0080  */
 /* unused                       0x0100  */
index 4d788dd8f0bf9876a09ef5e70b52860863c8fb54..664a24a178178431ec966343c4225fa7d189593a 100644 (file)
@@ -4328,12 +4328,6 @@ init_proxies_list_stage2:
                                li_init_per_thr(listener);
                        }
 #endif
-
-                       if (!LIST_ISEMPTY(&curproxy->tcp_req.l4_rules))
-                               listener->options |= LI_O_TCP_L4_RULES;
-
-                       if (!LIST_ISEMPTY(&curproxy->tcp_req.l5_rules))
-                               listener->options |= LI_O_TCP_L5_RULES;
                }
 
                /* Release unused SSL configs */
index bc042b7a101cd876c850a2a37ca95ba1174f4645..a6cca8243274c079fbf9e1a98ca533467be294f9 100644 (file)
@@ -190,7 +190,7 @@ int session_accept_fd(struct connection *cli_conn)
        /* now evaluate the tcp-request layer4 rules. We only need a session
         * and no stream for these rules.
         */
-       if ((l->options & LI_O_TCP_L4_RULES) && !tcp_exec_l4_rules(sess)) {
+       if (!LIST_ISEMPTY(&p->tcp_req.l4_rules) && !tcp_exec_l4_rules(sess)) {
                /* let's do a no-linger now to close with a single RST. */
                setsockopt(cfd, SOL_SOCKET, SO_LINGER, (struct linger *) &nolinger, sizeof(struct linger));
                ret = 0; /* successful termination */
@@ -433,7 +433,7 @@ int conn_complete_session(struct connection *conn)
                conn->flags |= CO_FL_XPRT_TRACKED;
 
        /* we may have some tcp-request-session rules */
-       if ((sess->listener->options & LI_O_TCP_L5_RULES) && !tcp_exec_l5_rules(sess))
+       if (!LIST_ISEMPTY(&sess->fe->tcp_req.l5_rules) && !tcp_exec_l5_rules(sess))
                goto fail;
 
        session_count_new(sess);