while reading `update_server_addr_port` I found out some things which can be seen as incoherency. I hope I did not overlooked anything:
- one comment is stating check's address should be updated if it uses the server one; however the condition checks if `SRV_F_CHECKADDR` is set; this flag is set when a check address is set; result is that we override the check address where I was not expecting it. In fact we don't need to update anything here as server addr is used when check addr is not set. - same goes for check agent addr - for port, it is a bit different, we update the check port if it is unset. This is harmless because we also use server port if check port is unset. However it creates some incoherency before/after using this command, as check port should stay unset througout the life of the process unless it is is set by `set server check-port` command. quite hard to locate the origin of this this issue but the function was introduced in commit d458adcc52b74608e2fe6a2a95f09ce5e94932b7 ("MINOR: new update_server_addr_port() function to change both server's ADDR and service PORT"). I was however not able to determine whether this is due to a change of behavior along the years. So this patch can potentially be backported up to v1.8 but we must be careful while doing so, as the code has changed a lot. That being said, the bug being not very impacting I would be fine keeping it for 2.4 only. Signed-off-by: William Dauchy <wdau...@gmail.com> --- src/server.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/server.c b/src/server.c index 10f528640..99b7e9181 100644 --- a/src/server.c +++ b/src/server.c @@ -3625,16 +3625,6 @@ const char *update_server_addr_port(struct server *s, const char *addr, const ch ipcpy(&sa, &s->addr); changed = 1; - /* we also need to update check's ADDR only if it uses the server's one */ - if ((s->check.state & CHK_ST_CONFIGURED) && (s->flags & SRV_F_CHECKADDR)) { - ipcpy(&sa, &s->check.addr); - } - - /* we also need to update agent ADDR only if it use the server's one */ - if ((s->agent.state & CHK_ST_CONFIGURED) && (s->flags & SRV_F_AGENTADDR)) { - ipcpy(&sa, &s->agent.addr); - } - /* update report for caller */ chunk_printf(msg, "IP changed from '%s' to '%s'", current_addr, addr); } @@ -3714,11 +3704,6 @@ const char *update_server_addr_port(struct server *s, const char *addr, const ch } chunk_appendf(msg, "%d'", new_port); - - /* we also need to update health checks port only if it uses server's realport */ - if ((s->check.state & CHK_ST_CONFIGURED) && !(s->flags & SRV_F_CHECKPORT)) { - s->check.port = new_port; - } } else { chunk_appendf(msg, "no need to change the port"); -- 2.30.0