diff options
author | Willy Tarreau <w@1wt.eu> | 2020-10-07 17:49:42 +0200 |
---|---|---|
committer | Willy Tarreau <w@1wt.eu> | 2020-10-07 19:42:32 +0200 |
commit | 4b833cb351801211df1530ed65d76daf8f139787 (patch) | |
tree | d74517514eef1fb960d7771962ceae55662d5a73 | |
parent | 3a2bab14ea2dc2af10038e73bd8832e0366fc0e7 (diff) | |
download | haproxy-4b833cb351801211df1530ed65d76daf8f139787.tar.gz |
MEDIUM: proxy: add mode PR_MODE_PEERS to flag peers frontends
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.
-rw-r--r-- | include/haproxy/proxy-t.h | 1 | ||||
-rw-r--r-- | src/cfgparse.c | 3 | ||||
-rw-r--r-- | src/peers.c | 1 |
3 files changed, 4 insertions, 1 deletions
diff --git a/include/haproxy/proxy-t.h b/include/haproxy/proxy-t.h index a17537aa5..da728a37e 100644 --- a/include/haproxy/proxy-t.h +++ b/include/haproxy/proxy-t.h @@ -49,6 +49,7 @@ enum pr_mode { PR_MODE_HEALTH, PR_MODE_CLI, PR_MODE_SYSLOG, + PR_MODE_PEERS, PR_MODES } __attribute__((packed)); diff --git a/src/cfgparse.c b/src/cfgparse.c index 0bc4b82a2..12585d061 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -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; diff --git a/src/peers.c b/src/peers.c index 8402cf329..3edd643d6 100644 --- a/src/peers.c +++ b/src/peers.c @@ -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); |