From owner-freebsd-bugs Sat Aug 26 7: 0: 7 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id EAED637B43C for ; Sat, 26 Aug 2000 07:00:00 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id HAA14965; Sat, 26 Aug 2000 07:00:00 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: by hub.freebsd.org (Postfix, from userid 32767) id 0EB9C37B424; Sat, 26 Aug 2000 06:51:35 -0700 (PDT) Message-Id: <20000826135135.0EB9C37B424@hub.freebsd.org> Date: Sat, 26 Aug 2000 06:51:35 -0700 (PDT) From: jml@cubical.fi To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: misc/20861: libc_r does not honor socket timeouts Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 20861 >Category: misc >Synopsis: libc_r does not honor socket timeouts >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Aug 26 07:00:00 PDT 2000 >Closed-Date: >Last-Modified: >Originator: Juha Liukkonen >Release: 4.1-RELEASE >Organization: Cubical Solutions Ltd >Environment: FreeBSD skitso.intra.net 4.1-RELEASE FreeBSD 4.1-RELEASE #0: Sat Aug 19 14:56:42 EEST 2000 root@skitso.intra.net:/usr/src/sys/compile/server-mp.conf i386 >Description: read(), write(), et al. in libc_r do not honor socket timeouts set via setsockopt(sd, SOL_SOCKET, SO_{SND,RCV}TIMEO, ...). Timeout is always set to NULL and the read loops consume EAGAIN. >How-To-Repeat: s = socket(...); setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, (void*) &timeout, sizeof(timeout)); connect(s, ...); read(s, buf, nbytes); <-- blocks and never returns EAGAIN >Fix: In read/write/etc. implementation, do a S_ISSOCK() on the descriptor, and if true, get a proper timeout value using _thread_sys_getsockopt() instead of assuming NULL. When the timeout expires, return EAGAIN if a proper timeout was used. >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message