-/* $OpenBSD: config.c,v 1.4 2014/07/25 16:23:19 reyk Exp $ */
+/* $OpenBSD: config.c,v 1.5 2014/07/25 23:30:58 reyk Exp $ */
/*
* Copyright (c) 2011 - 2014 Reyk Floeter <reyk@openbsd.org>
/* Check if server with matching listening socket already exists */
if ((srv = server_byaddr((struct sockaddr *)
- &srv_conf.ss)) != NULL) {
+ &srv_conf.ss, srv_conf.port)) != NULL) {
/* Add "host" to existing listening server */
close(imsg->fd);
return (config_getserver_config(env,
-/* $OpenBSD: httpd.h,v 1.14 2014/07/25 23:23:39 reyk Exp $ */
+/* $OpenBSD: httpd.h,v 1.15 2014/07/25 23:30:58 reyk Exp $ */
/*
* Copyright (c) 2006 - 2014 Reyk Floeter <reyk@openbsd.org>
int server_bufferevent_write(struct client *, void *, size_t);
void server_inflight_dec(struct client *, const char *);
struct server *
- server_byaddr(struct sockaddr *);
+ server_byaddr(struct sockaddr *, in_port_t);
SPLAY_PROTOTYPE(client_tree, client, clt_nodes, server_client_cmp);
-/* $OpenBSD: server.c,v 1.12 2014/07/25 23:23:39 reyk Exp $ */
+/* $OpenBSD: server.c,v 1.13 2014/07/25 23:30:58 reyk Exp $ */
/*
* Copyright (c) 2006 - 2014 Reyk Floeter <reyk@openbsd.org>
}
struct server *
-server_byaddr(struct sockaddr *addr)
+server_byaddr(struct sockaddr *addr, in_port_t port)
{
struct server *srv;
TAILQ_FOREACH(srv, env->sc_servers, srv_entry) {
- if (sockaddr_cmp((struct sockaddr *)&srv->srv_conf.ss,
+ if (port == srv->srv_conf.port &&
+ sockaddr_cmp((struct sockaddr *)&srv->srv_conf.ss,
addr, srv->srv_conf.prefixlen) == 0)
return (srv);
}