Welcome! Log In Create A New Profile

Advanced

[PATCH] minor harmless bugfix in server_parse_sni_expr

Posted by Olivier Houchard 
Olivier Houchard
[PATCH] minor harmless bugfix in server_parse_sni_expr
April 20, 2017 06:30PM
Hi,

In server_parse_sni_expr(), we use the "proxy" global variable when I think
we really want to use the "px" argument, so the attached patch fixes this.
Hopefully one day that proxy variable will be renamed :)

Olivier
From eb5033db545ae093f73485e4a29c112e126c159c Mon Sep 17 00:00:00 2001
From: Olivier Houchard <[email protected]>
Date: Thu, 20 Apr 2017 18:21:17 +0200
Subject: [PATCH] MINOR: server: don't use "proxy" when px is really meant.

In server_parse_sni_expr(), we use the "proxy" global variable, when we
should probably be using "px" given as an argument.
It happens to work by accident right now, but my not in the future.
---
src/server.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/server.c b/src/server.c
index 878293f..a151fd4 100644
--- a/src/server.c
+++ b/src/server.c
@@ -1539,10 +1539,10 @@ static int server_parse_sni_expr(struct server *newsrv, struct proxy *px, char *
};

idx = 0;
- proxy->conf.args.ctx = ARGC_SRV;
+ px->conf.args.ctx = ARGC_SRV;

expr = sample_parse_expr((char **)args, &idx, px->conf.file, px->conf.line,
- err, &proxy->conf.args);
+ err, &px->conf.args);
if (!expr) {
memprintf(err, "error detected while parsing sni expression : %s", *err);
return ERR_ALERT | ERR_FATAL;
--
2.9.3
Willy Tarreau
Re: [PATCH] minor harmless bugfix in server_parse_sni_expr
April 20, 2017 08:10PM
On Thu, Apr 20, 2017 at 06:25:17PM +0200, Olivier Houchard wrote:
> Hi,
>
> In server_parse_sni_expr(), we use the "proxy" global variable when I think
> we really want to use the "px" argument, so the attached patch fixes this.

Merged, thanks Olivier!

> Hopefully one day that proxy variable will be renamed :)

Yep I agree. We could prepare a small todo-list of things to do before
the release but after the main devs are merged (to avoid pissing off
those who work in their respective areas) :

- rename "proxy"
- ensure proxies, servers and other such objects are dual-linked lists
- replace malloc/free/strdup/realloc with ha_malloc() etc... to make it
easier to instrument it in the future for debug sessions ;
- change timers to become unsigned ints
- split check_config_validity()
- rename Alert() and Warning(), the two oldest functions in the code
that date from the time I was using a bit of CaMeLcAsE.

There are probably many other ones but these were the first one coming
to my mind.

Willy
Sorry, only registered users may post in this forum.

Click here to login