diff options
author | Omar Polo <op@omarpolo.com> | 2023-06-23 21:03:29 +0000 |
---|---|---|
committer | Omar Polo <op@omarpolo.com> | 2023-06-23 21:03:29 +0000 |
commit | 509d0509a50883a6f8407b63774f40dd1e41dadf (patch) | |
tree | ea2389673345057be53bccbcf653fb0435d77259 /gmid.h | |
parent | 37df23d183de23b74f8a026977b8210dc22701a6 (diff) |
implement `listen on'
Listening by default on all the addresses is so bad I don't know
why I haven't changed this before. Anyway.
Add a `listen on $hostname port $port' syntax to the config file
and deprecate the old "port" and "ipv6" global setting. Still try
to honour them when no "listen on" directive is used for backward
compatibily, but this will go away in the next next version hopefully.
At the moment the `listen on' in server context don't filter the
host, i.e. one can still reach a host from a address not specified
in the corresponding `liste on', this will be added later.
Diffstat (limited to 'gmid.h')
-rw-r--r-- | gmid.h | 34 |
1 files changed, 24 insertions, 10 deletions
@@ -104,6 +104,25 @@ struct parser { const char *err; }; +struct conf; +TAILQ_HEAD(addrhead, address); +struct address { + int ai_flags; + int ai_family; + int ai_socktype; + int ai_protocol; + struct sockaddr_storage ss; + socklen_t slen; + int16_t port; + + /* used in the server */ + struct conf *conf; + int sock; + struct event evsock; /* set if sock != -1 */ + + TAILQ_ENTRY(address) addrs; +}; + TAILQ_HEAD(fcgihead, fcgi); struct fcgi { int id; @@ -188,6 +207,8 @@ struct vhost { TAILQ_ENTRY(vhost) vhosts; + struct addrhead addrs; + /* * the first location rule is always '*' and holds the default * settings for the vhost, then follows the "real" location @@ -220,8 +241,6 @@ struct pki { struct conf { struct privsep *ps; - int port; - int ipv6; uint32_t protos; struct mime mime; char chroot[PATH_MAX]; @@ -230,14 +249,10 @@ struct conf { int reload; int use_privsep_crypto; - int sock4; - struct event evsock4; - int sock6; - struct event evsock6; - struct fcgihead fcgi; struct vhosthead hosts; struct pkihead pkis; + struct addrhead addrs; }; extern const char *config_path; @@ -258,6 +273,7 @@ enum { struct client { struct conf *conf; + struct address *addr; uint32_t id; struct tls *ctx; char *req; @@ -324,9 +340,7 @@ enum imsg_type { IMSG_RECONF_START, /* 7 */ IMSG_RECONF_MIME, IMSG_RECONF_PROTOS, - IMSG_RECONF_PORT, - IMSG_RECONF_SOCK4, - IMSG_RECONF_SOCK6, + IMSG_RECONF_SOCK, IMSG_RECONF_FCGI, IMSG_RECONF_HOST, IMSG_RECONF_CERT, |