summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorreyk <reyk@openbsd.org>2008-07-09 14:06:44 +0000
committerreyk <reyk@openbsd.org>2008-07-09 14:06:44 +0000
commit318e1f345a8b0ff340dfa75516c93244a5f93f97 (patch)
treeb30e5b3675a0db1613222e3a6d054b92edfac949
parentIncorporate Otto's yacc skeleton fix. (diff)
downloadwireguard-openbsd-318e1f345a8b0ff340dfa75516c93244a5f93f97.tar.xz
wireguard-openbsd-318e1f345a8b0ff340dfa75516c93244a5f93f97.zip
only use SOCK_STREAM for TCP in bindany(), otherwise SOCK_DGRAM for UDP.
-rw-r--r--usr.sbin/relayd/relayd.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.sbin/relayd/relayd.c b/usr.sbin/relayd/relayd.c
index f1588bd5fc3..fad7f12692d 100644
--- a/usr.sbin/relayd/relayd.c
+++ b/usr.sbin/relayd/relayd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: relayd.c,v 1.77 2008/06/11 18:21:20 reyk Exp $ */
+/* $OpenBSD: relayd.c,v 1.78 2008/07/09 14:06:44 reyk Exp $ */
/*
* Copyright (c) 2007, 2008 Reyk Floeter <reyk@openbsd.org>
@@ -1181,7 +1181,8 @@ bindany(struct ctl_bindany *bnd)
if (relay_socket_af(&bnd->bnd_ss, bnd->bnd_port) == -1)
goto fail;
- if ((s = socket(bnd->bnd_ss.ss_family, SOCK_STREAM,
+ if ((s = socket(bnd->bnd_ss.ss_family,
+ bnd->bnd_proto == IPPROTO_TCP ? SOCK_STREAM : SOCK_DGRAM,
bnd->bnd_proto)) == -1)
goto fail;
if (setsockopt(s, SOL_SOCKET, SO_BINDANY,