diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2014-07-25 23:30:59 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2014-07-25 23:30:59 +0000 |
commit | 3bcea5576bc0212c3b0959a12da791a293f4d4f5 (patch) | |
tree | 578da80c4f5fdb94c231d8e1aa96a9910256106a /usr.sbin | |
parent | 435736ac5e757b7575d9ab27128ad47f8e6950d2 (diff) |
Differentiate servers by address and port, not just by address.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/httpd/config.c | 4 | ||||
-rw-r--r-- | usr.sbin/httpd/httpd.h | 4 | ||||
-rw-r--r-- | usr.sbin/httpd/server.c | 7 |
3 files changed, 8 insertions, 7 deletions
diff --git a/usr.sbin/httpd/config.c b/usr.sbin/httpd/config.c index eb9e003ae8f..762a7a392a5 100644 --- a/usr.sbin/httpd/config.c +++ b/usr.sbin/httpd/config.c @@ -1,4 +1,4 @@ -/* $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> @@ -249,7 +249,7 @@ config_getserver(struct httpd *env, struct imsg *imsg) /* 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, diff --git a/usr.sbin/httpd/httpd.h b/usr.sbin/httpd/httpd.h index f88a46f2ca6..df34b477c98 100644 --- a/usr.sbin/httpd/httpd.h +++ b/usr.sbin/httpd/httpd.h @@ -1,4 +1,4 @@ -/* $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> @@ -388,7 +388,7 @@ int server_bufferevent_add(struct event *, int); 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); diff --git a/usr.sbin/httpd/server.c b/usr.sbin/httpd/server.c index 18fe06ca8a6..3ef140137c2 100644 --- a/usr.sbin/httpd/server.c +++ b/usr.sbin/httpd/server.c @@ -1,4 +1,4 @@ -/* $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> @@ -182,12 +182,13 @@ server_purge(struct server *srv) } 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); } |