]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: server: move send-proxy* incompatibility check in _srv_check_proxy_mode()
authorAurelien DARRAGON <adarragon@haproxy.com>
Fri, 27 Jun 2025 10:03:30 +0000 (12:03 +0200)
committerAurelien DARRAGON <adarragon@haproxy.com>
Fri, 27 Jun 2025 14:41:13 +0000 (16:41 +0200)
This way the check is executed no matter the section where the server
is declared (ie: not only under the "ring" section)

src/server.c
src/sink.c

index cfb2db3dfb2f8fb59ddcca92139e2b4210deb63f..cddfac0cf75de43a5b2e3bffc346a4f701c8b5ef 100644 (file)
@@ -3398,6 +3398,14 @@ static int _srv_check_proxy_mode(struct server *srv, char postparse)
                        err_code |= ERR_ALERT | ERR_FATAL;
                }
        }
+
+       if (srv->proxy->mode != PR_MODE_TCP && srv->proxy->mode != PR_MODE_HTTP &&
+           srv->pp_opts) {
+               srv->pp_opts = 0;
+               ha_warning("'send-proxy*' server option is unsupported there, ignoring it\n");
+               err_code |= ERR_WARN;
+       }
+
  out:
        if (srv->conf.file)
                reset_usermsgs_ctx();
index 73924ec7c6dbc75613bed30dfdb1a4856e601148..eef10006d051c78fd416b5401920bf2a94f82f5f 100644 (file)
@@ -1092,16 +1092,6 @@ int cfg_parse_ring(const char *file, int linenum, char **args, int kwm)
 
                if (err_code & ERR_CODE)
                        goto err;
-
-               /* FIXME: ideally this check should be performed during server postparsing
-                * for all proxies where this option is unsupported, but for now we lack
-                * server postparsing rules for sinks so let's put that here
-                */
-               if (cfg_sink->forward_px->srv && cfg_sink->forward_px->srv->pp_opts) {
-                       cfg_sink->forward_px->srv->pp_opts = 0;
-                       ha_warning("parsing [%s:%d] : 'send-proxy*' server option is unsupported there, ignoring it\n", file, linenum);
-                       err_code |= ERR_WARN;
-               }
        }
        else if (strcmp(args[0],"timeout") == 0) {
                if (!cfg_sink || !cfg_sink->forward_px) {