]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: proxy: add mode PR_MODE_PEERS to flag peers frontends
authorWilly Tarreau <w@1wt.eu>
Wed, 7 Oct 2020 15:49:42 +0000 (17:49 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 9 Oct 2020 16:28:21 +0000 (18:28 +0200)
For now we cannot easily distinguish a peers frontend from another one,
which will be problematic to avoid reporting them when stopping their
listeners. Let's add PR_MODE_PEERS for this. It's not supposed to cause
any issue since all non-HTTP proxies are handled similarly now.

include/haproxy/proxy-t.h
src/cfgparse.c
src/peers.c

index a17537aa5ab882d9eea5cc0b7cf272d278fa3b5c..da728a37ed4ed772dc8e7905de5cf8ae2234ecc3 100644 (file)
@@ -49,6 +49,7 @@ enum pr_mode {
        PR_MODE_HEALTH,
        PR_MODE_CLI,
        PR_MODE_SYSLOG,
+       PR_MODE_PEERS,
        PR_MODES
 } __attribute__((packed));
 
index 0bc4b82a2614b267356cbe76dacc1a3f3df1a1d5..12585d0618f527b2c1a06494b2f53001cb36d9d1 100644 (file)
@@ -2355,9 +2355,10 @@ int check_config_validity()
                        cfgerr += proxy_cfg_ensure_no_http(curproxy);
                        break;
                case PR_MODE_SYSLOG:
+               case PR_MODE_PEERS:
                case PR_MODES:
                        /* should not happen, bug gcc warn missing switch statement */
-                       ha_alert("config : %s '%s' cannot use syslog mode for this proxy.\n",
+                       ha_alert("config : %s '%s' cannot use peers or syslog mode for this proxy. NOTE: PLEASE REPORT THIS TO DEVELOPERS AS YOU'RE NOT SUPPOSED TO BE ABLE TO CREATE A CONFIGURATION TRIGGERING THIS!\n",
                                 proxy_type_str(curproxy), curproxy->id);
                        cfgerr++;
                        break;
index 8402cf3299f2d6fa03037e753186a21048aff667..3edd643d604dabfa844eec8e16a7a556678d2787 100644 (file)
@@ -2521,6 +2521,7 @@ void peers_setup_frontend(struct proxy *fe)
 {
        fe->last_change = now.tv_sec;
        fe->cap = PR_CAP_FE | PR_CAP_BE;
+       fe->mode = PR_MODE_PEERS;
        fe->maxconn = 0;
        fe->conn_retries = CONN_RETRIES;
        fe->timeout.client = MS_TO_TICKS(5000);