static int srv_parse_from(char **args, int *cur_arg,
struct proxy *curproxy, struct server *newsrv, char **err)
{
- memprintf(err, "'%s' is a positional keyword. It must be specified"
- " before any other server setting", args[*cur_arg]);
+ if (curproxy->mode == PR_MODE_PEERS) {
+ memprintf(err, "'%s' not supported in a peers section", args[*cur_arg]);
+ }
+ else {
+ memprintf(err, "'%s' is a positional keyword. It must be specified"
+ " before any other server setting", args[*cur_arg]);
+ }
return ERR_ALERT | ERR_FATAL;
}
else {
/* Parse optional "name" default-server keyword. */
if (*args[1] && strcmp(args[1], "name") == 0) {
+ if (parse_flags & SRV_PARSE_IN_PEER_SECTION) {
+ ha_alert("named default-server are not supported in a peers section.\n");
+ err_code |= ERR_ALERT | ERR_FATAL;
+ goto out;
+ }
+
if (!*args[2]) {
ha_alert("default-server name: missing value.\n");
err_code |= ERR_ALERT | ERR_FATAL;
int err_code = ERR_NONE;
if (strcmp(args[*cur_arg], "from") == 0) {
+ if (parse_flags & SRV_PARSE_IN_PEER_SECTION) {
+ ha_alert("'%s' not supported in a peers section.\n", args[*cur_arg]);
+ err_code |= ERR_FATAL | ERR_ALERT;
+ goto out;
+ }
+
if (!*args[*cur_arg + 1]) {
ha_alert("from: missing value.\n");
err_code |= ERR_FATAL | ERR_ALERT;