Hi again Krzysztof,
On Fri, Oct 19, 2007 at 04:50:26PM +0200, Krzysztof Oledzki wrote:
> Hello,
>
> Currently haproxy accepts a config with duplicated proxies
> (listen/fronted/backed/ruleset). This patch fix this, so the application
> will complain when there is an error.
>
> With this modification it is still possible to use the same name for two
> proxies (for example frontend&backend) as long there is no conflict:
>
> listen backend frontend ruleset
> listen - - - OK
> backend - - OK OK
> frontend - OK - OK
> ruleset OK OK OK -
After some thinking, the listen should not share its name with anything, because it also provides the "ruleset" capability. BTW, while rulesets can be declared, they are currently not really used. The goal was to be able to share complex rulesets between various listeners instead of having to rewrite them each time.
I would rather have something like this :
listen backend frontend ruleset listen - - - - backend - - OK OK frontend - OK - OK ruleset - OK OK -
This translates into an even simpler test, as instead of this :
> + if (!strcmp(curproxy->id, args[1]) &&
> + ((curproxy->cap==rc) || (curproxy->cap & rc & (PR_CAP_FE | PR_CAP_BE)))) {
> + Alert("parsing %s: duplicated proxy %s with conflicting capabilities: %X/%X!\n",
> + file, args[1], curproxy->cap, rc);
> + return -1;
> + }
We can use this :
+ if (!strcmp(curproxy->id, args[1]) && + (curproxy->cap & rc & (PR_CAP_LISTEN))) { + Alert("parsing %s: duplicated proxy %s with conflicting capabilities: %X/%X!\n", + file, args[1], curproxy->cap, rc); + return -1; + }
Cheers,
Willy
Received on 2007/10/20 10:05
This archive was generated by hypermail 2.2.0 : 2007/11/04 19:21 CET