goto out;
}
+ /* Only one listener supported. Compare first listener
+ * against the last one. It must be the same one.
+ */
+ if (bind_conf->listeners.n != bind_conf->listeners.p) {
+ ha_alert("parsing [%s:%d] : Only one listener per \"peers\" section is authorized. Multiple listening addresses or port range are not supported.\n", file, linenum);
+ err_code |= ERR_ALERT | ERR_FATAL;
+ goto out;
+ }
/*
* Newly allocated listener is at the end of the list
*/
curpeers->peers_fe->flags |= PR_FL_READY;
p = curpeers->remote;
while (p) {
+ struct peer *other_peer;
+
+ for (other_peer = curpeers->remote; other_peer && other_peer != p; other_peer = other_peer->next) {
+ if (strcmp(other_peer->id, p->id) == 0) {
+ ha_alert("Peer section '%s' [%s:%d]: another peer named '%s' was already defined at line %s:%d, please use distinct names.\n",
+ curpeers->peers_fe->id,
+ p->conf.file, p->conf.line,
+ other_peer->id, other_peer->conf.file, other_peer->conf.line);
+ cfgerr++;
+ break;
+ }
+ }
+
if (p->srv) {
if (p->srv->use_ssl == 1 && xprt_get(XPRT_SSL) && xprt_get(XPRT_SSL)->prepare_srv)
cfgerr += xprt_get(XPRT_SSL)->prepare_srv(p->srv);
sk = str2sa_range(args[*cur_arg], &port, &port1, &port2, NULL, NULL,
&errmsg, NULL, &fqdn,
- (parse_flags & SRV_PARSE_INITIAL_RESOLVE ? PA_O_RESOLVE : 0) | PA_O_PORT_OK | PA_O_PORT_OFS | PA_O_STREAM | PA_O_XPRT | PA_O_CONNECT);
+ (parse_flags & SRV_PARSE_INITIAL_RESOLVE ? PA_O_RESOLVE : 0) | PA_O_PORT_OK |
+ (parse_flags & SRV_PARSE_IN_PEER_SECTION ? PA_O_PORT_MAND : PA_O_PORT_OFS) |
+ PA_O_STREAM | PA_O_XPRT | PA_O_CONNECT);
if (!sk) {
ha_alert("%s\n", errmsg);
err_code |= ERR_ALERT | ERR_FATAL;