From owner-freebsd-net@FreeBSD.ORG Sun Jul 2 15:47:40 2006 Return-Path: X-Original-To: net@freebsd.org Delivered-To: freebsd-net@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 12B7716A407 for ; Sun, 2 Jul 2006 15:47:40 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [209.31.154.42]) by mx1.FreeBSD.org (Postfix) with ESMTP id B1AF1442F5 for ; Sun, 2 Jul 2006 15:47:39 +0000 (GMT) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [209.31.154.41]) by cyrus.watson.org (Postfix) with ESMTP id 544ED46C16; Sun, 2 Jul 2006 11:47:39 -0400 (EDT) Date: Sun, 2 Jul 2006 16:47:39 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Stefan Bethke In-Reply-To: <7024797F-62A3-43C0-A119-50A3DD34B279@lassitu.de> Message-ID: <20060702164232.G67344@fledge.watson.org> References: <200606271813.29980.mi+mx@aldan.algebra.com> <7024797F-62A3-43C0-A119-50A3DD34B279@lassitu.de> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: rizzo@icir.org, Mikhail Teterin , net@freebsd.org Subject: Re: using ipfw seems to interfere with socket communication X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jul 2006 15:47:40 -0000 On Sun, 2 Jul 2006, Stefan Bethke wrote: > Essentially, dummynet delays processing of that "two" line just long enough > to break the code's assumption that TCP over the loopback interface is > instantaneous. If my fading memory of TCP/IP Illustrated Vol 2 serves me > right, that was actually the case at least back then: the sendto system call > would push the data all the way down to lo0, which would immediately pass it > back up until it ended up in the receiving socket buffer. Dummynet will > queue the packet, regardless, so it won't get delivered until the next time > dummynet processes queues. With TCP (and UDP), the ability to immediately deliver has never been guaranteed due to socket buffer and window limits, scheduling priority, etc. TCP over the loopback interface really is TCP -- data is broken up into segments, wrapped in TCP/IP headers, processed by the firewall and dummynet, etc. UNIX domain sockets should be used if it's desirable to avoid this, as that implementation delivers directly to the remote socket buffer. However, due to socket buffer sizing and scheduling, blocking is possible there also. Stream sockets do not guarantee message boundary atomicity or immediate delivery, especially in the presence of SMP. Robert N M Watson Computer Laboratory University of Cambridge