From owner-freebsd-i386@FreeBSD.ORG Fri Jul 4 10:50:02 2008 Return-Path: Delivered-To: freebsd-i386@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5981E1065673 for ; Fri, 4 Jul 2008 10:50:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 35E6C8FC18 for ; Fri, 4 Jul 2008 10:50:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m64Ao16q060157 for ; Fri, 4 Jul 2008 10:50:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m64Ao1AU060156; Fri, 4 Jul 2008 10:50:01 GMT (envelope-from gnats) Resent-Date: Fri, 4 Jul 2008 10:50:01 GMT Resent-Message-Id: <200807041050.m64Ao1AU060156@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-i386@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Giampaolo Rodolà Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D2D76106567D for ; Fri, 4 Jul 2008 10:43:31 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id C15C28FC1C for ; Fri, 4 Jul 2008 10:43:31 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.2/8.14.2) with ESMTP id m64AhVfm093881 for ; Fri, 4 Jul 2008 10:43:31 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.2/8.14.1/Submit) id m64AhVjh093880; Fri, 4 Jul 2008 10:43:31 GMT (envelope-from nobody) Message-Id: <200807041043.m64AhVjh093880@www.freebsd.org> Date: Fri, 4 Jul 2008 10:43:31 GMT From: Giampaolo Rodolà To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: i386/125258: socket's SO_REUSEADDR option does not work X-BeenThere: freebsd-i386@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: I386-specific issues for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jul 2008 10:50:02 -0000 >Number: 125258 >Category: i386 >Synopsis: socket's SO_REUSEADDR option does not work >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-i386 >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Jul 04 10:50:01 UTC 2008 >Closed-Date: >Last-Modified: >Originator: Giampaolo Rodolà >Release: 7.0-RC1 >Organization: >Environment: FreeBSD dhcppc1 7.0-RC1 >Description: When the SO_OOBINLINE option is used against a socket, out-of-band data should be placed in the normal data input stream as it is received. In fact this is what happens on Windows and Linux by using the Python script below. On FreeBSD this does not happen. select instead of returning a "readable" file descriptor returns an "exceptional" file descriptor. Later, when I try to read some data from the socket, the following exception is raised: Exception in thread Thread-1: Traceback (most recent call last): File "/usr/local/lib/python2.5/threading.py", line 460, in __bootstrap self.run() File "/usr/local/lib/python2.5/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "_test2.py", line 14, in server data = conn.recv(1024, socket.MSG_OOB) error: (22, 'Invalid argument') --- code --- import socket, select, threading, time, os def server(): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) s.bind(('', 1024)) s.listen(1) conn, addr = s.accept() conn.setblocking(0) conn.setsockopt(socket.SOL_SOCKET, socket.SO_OOBINLINE, 1) while 1: r, w, e = select.select([conn], [conn], [conn], 0.01) if r: # the socket is supposed to be in the "readable" list data = conn.recv(1024) print "read -> " + data if e: # ...but not in the "exception" list data = conn.recv(1024, socket.MSG_OOB) print "expt -> " + data threading.Thread(target=server).start() time.sleep(0.1) s = socket.socket() s.connect(('127.0.0.1', 1024)) s.sendall('x', socket.MSG_OOB) --- /code --- >How-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted: