Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Aug 2000 06:51:35 -0700 (PDT)
From:      jml@cubical.fi
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/20861: libc_r does not honor socket timeouts
Message-ID:  <20000826135135.0EB9C37B424@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000826135135.0EB9C37B424>