summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgilles <gilles@openbsd.org>2016-02-22 16:19:05 +0000
committergilles <gilles@openbsd.org>2016-02-22 16:19:05 +0000
commit1f5535ea3042010b44993f52fcfd9468a7ebb24b (patch)
tree7d8be382972b1283fd491cfca88dfd2fe5628195
parentput mutex.h lower (diff)
downloadwireguard-openbsd-1f5535ea3042010b44993f52fcfd9468a7ebb24b.tar.xz
wireguard-openbsd-1f5535ea3042010b44993f52fcfd9468a7ebb24b.zip
the default address family for a listener was set too late and would
override the value provided by the user if any. this commit moves the initialization earlier to avoid this. issue reported by and fix ok jturner@
-rw-r--r--usr.sbin/smtpd/parse.y13
1 files changed, 6 insertions, 7 deletions
diff --git a/usr.sbin/smtpd/parse.y b/usr.sbin/smtpd/parse.y
index c3747a86abf..33bae1c3127 100644
--- a/usr.sbin/smtpd/parse.y
+++ b/usr.sbin/smtpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.182 2016/02/13 20:43:07 gilles Exp $ */
+/* $OpenBSD: parse.y,v 1.183 2016/02/22 16:19:05 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -469,7 +469,7 @@ opt_if_listen : INET4 {
if (config_lo_filter(&listen_opts, $2)) {
YYERROR;
}
-}
+ }
| SMTPS {
if (listen_opts.options & LO_SSL) {
yyerror("TLS mode already specified");
@@ -663,7 +663,7 @@ opt_if_listen : INET4 {
;
listener_type : socket_listener
- | interface_listener
+ | if_listener
;
socket_listener : SOCKET sock_listen {
@@ -675,10 +675,7 @@ socket_listener : SOCKET sock_listen {
}
;
-interface_listener:
- STRING if_listen {
- listen_opts.family = AF_UNSPEC;
- listen_opts.flags |= F_EXT_DSN;
+if_listener : STRING if_listen {
listen_opts.ifx = $1;
create_if_listener(conf->sc_listeners, &listen_opts);
}
@@ -882,6 +879,8 @@ main : BOUNCEWARN {
| LIMIT SCHEDULER limits_scheduler
| LISTEN {
memset(&listen_opts, 0, sizeof listen_opts);
+ listen_opts.family = AF_UNSPEC;
+ listen_opts.flags |= F_EXT_DSN;
} ON listener_type
| FILTER STRING STRING {
if (!strcmp($3, "chain")) {