]> git.kaiwu.me - haproxy.git/commitdiff
BUILD: makefile: add an option to enable or disable SPOE (USE_SPOE)
authorWilly Tarreau <w@1wt.eu>
Thu, 21 May 2026 12:35:21 +0000 (14:35 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 3 Jul 2026 14:33:27 +0000 (16:33 +0200)
USE_SPOE is enabled by default and allows to disable SPOE when forced to
zero. It saves roughly 92kB on the executable.

Makefile
src/cfgparse-listen.c
src/tcpcheck.c

index be1df359a311abdeaad7135bc9156c4b5cea1292..b046d1917f32b70587243901349ac86400e1db73 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -67,6 +67,7 @@
 #   USE_KTLS                : use kTLS.(requires at least Linux 4.17).
 #   USE_FCGI                : enable the FCGI subsystem. Always on.
 #   USE_H2                  : enable HTTP/2 subsystem. Always on.
+#   USE_SPOE                : enable the SPOE subsystem. Always on.
 #
 # Options can be forced by specifying "USE_xxx=1" or can be disabled by using
 # "USE_xxx=" (empty string). The list of enabled and disabled options for a
@@ -340,7 +341,7 @@ use_opts = USE_EPOLL USE_KQUEUE USE_NETFILTER USE_POLL                        \
            USE_TPROXY USE_LINUX_TPROXY USE_LINUX_CAP                          \
            USE_LINUX_SPLICE USE_LIBCRYPT USE_CRYPT_H USE_ENGINE               \
            USE_GETADDRINFO USE_OPENSSL USE_OPENSSL_WOLFSSL USE_OPENSSL_AWSLC  \
-           USE_ECH USE_TRACE USE_FCGI USE_H2                                  \
+           USE_ECH USE_TRACE USE_FCGI USE_H2 USE_SPOE                         \
            USE_SSL USE_LUA USE_ACCEPT4 USE_CLOSEFROM USE_ZLIB USE_SLZ         \
            USE_CPU_AFFINITY USE_TFO USE_NS USE_DL USE_RT USE_LIBATOMIC        \
            USE_MATH USE_DEVICEATLAS USE_51DEGREES                             \
@@ -372,6 +373,9 @@ USE_FCGI = default
 # HTTP/2 is always enabled
 USE_H2 = default
 
+# SPOE is always enabled
+USE_SPOE = default
+
 # SLZ is always supported unless explicitly disabled by passing USE_SLZ=""
 # or disabled by enabling ZLIB using USE_ZLIB=1
 ifeq ($(USE_ZLIB:0=),)
@@ -583,6 +587,10 @@ ifneq ($(USE_FCGI:0=),)
   OPTIONS_OBJS   += src/mux_fcgi.o src/fcgi-app.o src/fcgi.o
 endif
 
+ifneq ($(USE_SPOE:0=),)
+  OPTIONS_OBJS   += src/mux_spop.o src/flt_spoe.o
+endif
+
 ifneq ($(USE_SLZ:0=),)
   OPTIONS_OBJS   += src/slz.o
 endif
@@ -929,13 +937,13 @@ endif
 
 OBJS += src/mux_h1.o src/log.o                                         \
         src/server.o src/stream.o src/tcpcheck.o src/http_ana.o                \
-        src/stick_table.o src/tools.o src/mux_spop.o src/sample.o      \
+        src/stick_table.o src/tools.o src/sample.o                     \
         src/activity.o src/cfgparse.o src/peers.o src/cli.o            \
         src/backend.o src/connection.o src/resolvers.o src/proxy.o     \
         src/cache.o src/stconn.o src/http_htx.o src/debug.o            \
         src/check.o src/stats-html.o src/haproxy.o src/listener.o      \
         src/applet.o src/pattern.o src/cfgparse-listen.o               \
-        src/flt_spoe.o src/cebis_tree.o src/http_ext.o                 \
+        src/cebis_tree.o src/http_ext.o                                        \
         src/http_act.o src/http_fetch.o src/cebs_tree.o                        \
         src/cebib_tree.o src/http_client.o src/dns.o                   \
         src/cebb_tree.o src/vars.o src/event_hdl.o src/tcp_rules.o     \
index ca5d3ad62d9d65edc53e4b7de519e28793526366..92b77661c3d9cdcc71216ab19e5cadabf3eb5fd3 100644 (file)
@@ -2431,11 +2431,13 @@ stats_error_parsing:
                        if (err_code & ERR_FATAL)
                                goto out;
                }
+#if defined(USE_SPOE)
                else if (strcmp(args[1], "spop-check") == 0) {
                        err_code |= proxy_parse_spop_check_opt(args, 0, curproxy, curr_defproxy, file, linenum);
                        if (err_code & ERR_FATAL)
                                goto out;
                }
+#endif
                else if (strcmp(args[1], "tcp-check") == 0) {
                        err_code |= proxy_parse_tcp_check_opt(args, 0, curproxy, curr_defproxy, file, linenum);
                        if (err_code & ERR_FATAL)
index 1a8d8bf23d73b62c73db033eafd79136a32ea394..c9142f43a4231cbad864af965255ed662e1a74d6 100644 (file)
@@ -777,6 +777,7 @@ enum tcpcheck_eval_ret tcpcheck_ldap_expect_bindrsp(struct check *check, struct
        goto out;
 }
 
+#if defined(USE_SPOE)
 /* Custom tcp-check expect function to parse and validate the SPOP HELLO
  * response packet. Returns TCPCHK_EVAL_WAIT to wait for more data,
  * TCPCHK_EVAL_CONTINUE to evaluate the next rule or TCPCHK_EVAL_STOP if an
@@ -985,6 +986,7 @@ enum tcpcheck_eval_ret tcpcheck_spop_expect_hello(struct check *check, struct tc
        ret = TCPCHK_EVAL_WAIT;
        goto out;
 }
+#endif /* USE_SPOE */
 
 /* Custom tcp-check expect function to parse and validate the agent-check
  * reply. Returns TCPCHK_EVAL_WAIT to wait for more data, TCPCHK_EVAL_CONTINUE
@@ -5130,6 +5132,7 @@ static int do_parse_ldap_check_opt(char **args, int cur_arg, struct proxy *curpx
        goto out;
 }
 
+#if defined(USE_SPOE)
 static int do_parse_spop_check_opt(char **args, int cur_arg, struct proxy *curpx, struct tcpcheck_ruleset *rs,
                                   const char *file, int line)
 {
@@ -5189,6 +5192,7 @@ static int do_parse_spop_check_opt(char **args, int cur_arg, struct proxy *curpx
        err_code |= ERR_ALERT | ERR_FATAL;
        goto out;
 }
+#endif /* USE_SPOE */
 
 
 static struct tcpcheck_rule *do_parse_httpchk_req(char **args, int cur_arg, struct proxy *px, char **errmsg)
@@ -5555,6 +5559,7 @@ int proxy_parse_ldap_check_opt(char **args, int cur_arg, struct proxy *curpx, co
        return err_code;
 }
 
+#if defined(USE_SPOE)
 /* Parses the "option spop-check" proxy keyword */
 int proxy_parse_spop_check_opt(char **args, int cur_arg, struct proxy *curpx, const struct proxy *defpx,
                               const char *file, int line)
@@ -5584,6 +5589,7 @@ int proxy_parse_spop_check_opt(char **args, int cur_arg, struct proxy *curpx, co
   out:
        return err_code;
 }
+#endif /* USE_SPOE */
 
 /* Parses the "option mysql-check" proxy keyword */
 int proxy_parse_mysql_check_opt(char **args, int cur_arg, struct proxy *curpx, const struct proxy *defpx,
@@ -5843,11 +5849,13 @@ int cfg_parse_healthchecks(const char *file, int linenum, char **args, int kwm)
                        err_code |= do_parse_ldap_check_opt(args, 2, tcpchecks_proxy, cur_rs, file, linenum);
                        goto out;
                }
+#if defined(USE_SPOE)
                else if (strcmp(args[1], "spop-check") == 0) {
                        cur_rs->flags |= TCPCHK_RULES_SPOP_CHK;
                        err_code |= do_parse_spop_check_opt(args, 2, tcpchecks_proxy, cur_rs, file, linenum);
                        goto out;
                }
+#endif
                else {
                        ha_alert("parsing [%s:%d] : unknown healthcheck type '%s' (expects 'tcp-check', 'httpchk', 'ssl-hello-chk', "
                                 "'smtpchk', 'pgsql-check', 'redis-check', 'mysql-check', 'ldap-check', 'spop-check').\n",