mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-24 15:21:29 +02:00
Revert "BUG/MINOR: peers: set the proxy's name to the peers section name"
This reverts commit 356866accefd16458f0e3c335d1b784e24e86d2d. It seems that an undocumented expectation of peers is based on the peers proxy name to determine if the local peer is fully configured or not. Thus because of the commit above, we are no longer able to detect incomplete peers sections. On side effect of this bug is a segfault when HAProxy is stopped/reloaded if we try to perform a local resync on a mis-configured local peer. So waiting for a better solution, the patch is reverted. This patch must be backported as far as 2.5.
This commit is contained in:
parent
708949da49
commit
244331f6e7
@ -566,12 +566,13 @@ unsigned long parse_cpu_set(const char **args, struct hap_cpuset *cpu_set,
|
||||
#endif
|
||||
|
||||
/* Allocate and initialize the frontend of a "peers" section found in
|
||||
* file <file> at line <linenum> for section <peers>.
|
||||
* file <file> at line <linenum> with <id> as ID.
|
||||
* Return 0 if succeeded, -1 if not.
|
||||
* Note that this function may be called from "default-server"
|
||||
* or "peer" lines.
|
||||
*/
|
||||
static int init_peers_frontend(const char *file, int linenum, struct peers *peers)
|
||||
static int init_peers_frontend(const char *file, int linenum,
|
||||
const char *id, struct peers *peers)
|
||||
{
|
||||
struct proxy *p;
|
||||
|
||||
@ -593,9 +594,8 @@ static int init_peers_frontend(const char *file, int linenum, struct peers *peer
|
||||
peers->peers_fe = p;
|
||||
|
||||
out:
|
||||
if (!p->id && peers->id)
|
||||
p->id = strdup(peers->id);
|
||||
|
||||
if (id && !p->id)
|
||||
p->id = strdup(id);
|
||||
free(p->conf.file);
|
||||
p->conf.args.file = p->conf.file = strdup(file);
|
||||
if (linenum != -1)
|
||||
@ -697,7 +697,7 @@ int cfg_parse_peers(const char *file, int linenum, char **args, int kwm)
|
||||
|
||||
cur_arg = 1;
|
||||
|
||||
if (init_peers_frontend(file, linenum, curpeers) != 0) {
|
||||
if (init_peers_frontend(file, linenum, NULL, curpeers) != 0) {
|
||||
err_code |= ERR_ALERT | ERR_ABORT;
|
||||
goto out;
|
||||
}
|
||||
@ -771,7 +771,7 @@ int cfg_parse_peers(const char *file, int linenum, char **args, int kwm)
|
||||
goto out;
|
||||
}
|
||||
else if (strcmp(args[0], "default-server") == 0) {
|
||||
if (init_peers_frontend(file, -1, curpeers) != 0) {
|
||||
if (init_peers_frontend(file, -1, NULL, curpeers) != 0) {
|
||||
err_code |= ERR_ALERT | ERR_ABORT;
|
||||
goto out;
|
||||
}
|
||||
@ -779,7 +779,7 @@ int cfg_parse_peers(const char *file, int linenum, char **args, int kwm)
|
||||
SRV_PARSE_DEFAULT_SERVER|SRV_PARSE_IN_PEER_SECTION|SRV_PARSE_INITIAL_RESOLVE);
|
||||
}
|
||||
else if (strcmp(args[0], "log") == 0) {
|
||||
if (init_peers_frontend(file, linenum, curpeers) != 0) {
|
||||
if (init_peers_frontend(file, linenum, NULL, curpeers) != 0) {
|
||||
err_code |= ERR_ALERT | ERR_ABORT;
|
||||
goto out;
|
||||
}
|
||||
@ -876,6 +876,7 @@ int cfg_parse_peers(const char *file, int linenum, char **args, int kwm)
|
||||
/* Line number and peer ID are updated only if this peer is the local one. */
|
||||
if (init_peers_frontend(file,
|
||||
newpeer->local ? linenum: -1,
|
||||
newpeer->local ? newpeer->id : NULL,
|
||||
curpeers) != 0) {
|
||||
err_code |= ERR_ALERT | ERR_ABORT;
|
||||
goto out;
|
||||
@ -968,7 +969,7 @@ int cfg_parse_peers(const char *file, int linenum, char **args, int kwm)
|
||||
size_t prefix_len;
|
||||
|
||||
/* Line number and peer ID are updated only if this peer is the local one. */
|
||||
if (init_peers_frontend(file, -1, curpeers) != 0) {
|
||||
if (init_peers_frontend(file, -1, NULL, curpeers) != 0) {
|
||||
err_code |= ERR_ALERT | ERR_ABORT;
|
||||
goto out;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user