From: reyk Date: Wed, 9 Jul 2008 14:06:44 +0000 (+0000) Subject: only use SOCK_STREAM for TCP in bindany(), otherwise SOCK_DGRAM for UDP. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=318e1f345a8b0ff340dfa75516c93244a5f93f97;p=openbsd only use SOCK_STREAM for TCP in bindany(), otherwise SOCK_DGRAM for UDP. --- 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 @@ -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,