Subject: kern/3682: SO_SNDTIMEO/SO_RCVTIMEO bug in sogetopt()
To: None <gnats-bugs@gnats.netbsd.org>
From: None <koji@math.human.nagoya-u.ac.jp>
List: netbsd-bugs
Date: 05/29/1997 22:49:28
>Number:         3682
>Category:       kern
>Synopsis:       SO_SNDTIMEO/SO_RCVTIMEO bug in sogetopt()
>Confidential:   yes
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu May 29 09:20:01 1997
>Last-Modified:
>Originator:     Koji Imada - je4owb/2
>Organization:
Mathematics Group of Graduate School of Human
	Infomatics, Nagoya University, Japan.
>Release:        970523
>Environment:
	
System: NetBSD bimota 1.2E NetBSD 1.2E (BIMOTA) #30: Tue May 13 23:32:51 JST 1997 koji@ducati:/mnt2/NetBSD/work/src-ufs-mod/sys/arch/i386/compile/BIMOTA i386


>Description:
	When getting send/receive timeout option of socket with
	SO_SNDTIMEO/SO_RCVTIME, returned timeval is not correct.

	This is described in "TCP/IP Illustrated vol. 2" p.548.
>How-To-Repeat:
	As you see.
>Fix:
	Apply following patch.

--- uipc_socket.c.orig	Thu May 29 22:37:15 1997
+++ uipc_socket.c	Thu May 29 22:36:07 1997
@@ -1030,7 +1030,7 @@
 			m->m_len = sizeof(struct timeval);
 			mtod(m, struct timeval *)->tv_sec = val / hz;
 			mtod(m, struct timeval *)->tv_usec =
-			    (val % hz) / tick;
+			    (val % hz) * tick;
 			break;
 		    }
 

>Audit-Trail:
>Unformatted: