From owner-freebsd-net@FreeBSD.ORG Mon Nov 15 20:09:45 2004 Return-Path: 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 7EE6416A541; Mon, 15 Nov 2004 20:09:44 +0000 (GMT) Received: from relay.bestcom.ru (relay.bestcom.ru [217.72.144.5]) by mx1.FreeBSD.org (Postfix) with ESMTP id B172943D46; Mon, 15 Nov 2004 20:09:43 +0000 (GMT) (envelope-from glebius@freebsd.org) Received: from cell.sick.ru (root@cell.sick.ru [217.72.144.68]) by relay.bestcom.ru (8.13.1/8.12.9) with ESMTP id iAFK9cPD086989 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Mon, 15 Nov 2004 23:09:39 +0300 (MSK) (envelope-from glebius@freebsd.org) Received: from cell.sick.ru (glebius@localhost [127.0.0.1]) by cell.sick.ru (8.12.11/8.12.8) with ESMTP id iAFK9bU9096984 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 15 Nov 2004 23:09:38 +0300 (MSK) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.sick.ru (8.12.11/8.12.11/Submit) id iAFK9bO1096983; Mon, 15 Nov 2004 23:09:37 +0300 (MSK) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.sick.ru: glebius set sender to glebius@freebsd.org using -f Date: Mon, 15 Nov 2004 23:09:36 +0300 From: Gleb Smirnoff To: Archie Cobbs Message-ID: <20041115200936.GB96804@cell.sick.ru> References: <20041115104331.GA93477@cell.sick.ru> <200411151417.iAFEHfhN015171@arch20m.dellroad.org> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <200411151417.iAFEHfhN015171@arch20m.dellroad.org> User-Agent: Mutt/1.5.6i X-Virus-Scanned: clamd / ClamAV version devel-20041013, clamav-milter version 0.75l on 127.0.0.1 X-Virus-Status: Clean cc: maxim@freebsd.org cc: rwatson@freebsd.org cc: net@freebsd.org Subject: Re: divert(4) socket isn't connection oriented X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Nov 2004 20:09:45 -0000 On Mon, Nov 15, 2004 at 08:17:41AM -0600, Archie Cobbs wrote: A> > Since it is working, it was not noticed quickly. Real problems occur when A> > a multicast packet comes on interface: it is diverted to ng_ksocket, returned A> > and div_output() sends it to ip_output(). In ip_output() it is ip_mloopback()ed A> > and if_simloop()ed. A copy of packet enters divert socket, duplicated... a A> > forever loop and total freeze. A> A> Your fix makes sense, but is it more of a workaround than a proper fix? I don't think so. Is divert(4) connection oriented? No, therefore so->so_state & SS_ISCONNECTED must be zero; therefore it shouldn't have pru_disconnect method. Does divert(4) has listen queue? No, therefore it shouldn't have pru_abort method. A> It seems like the real bug is that divert is promising to write the packet A> as "outgoing" yet the packet loops back as "incoming". Maybe it would make A> more sense to attach a tag to the packet that divert would recognize and A> know to ignore the extra incoming packet. This would be a workaround. divert(4) protocol uses sockaddr for this purpose, because m_tags do not pass thru userland. And ng_ksocket should emulate userland socket perfectly, otherwise it has no sense. It must understand sockaddr. A> Also, does the same thing happen with broadcast packets? No. So, the real change suggested is to remove SS_ISCONNECTED from so->so_state. All other changes are its logical consequences. What was idea of that SS_ISCONNECTED flag always set? I can't find any problems we can get by removing this code. -- Totus tuus, Glebius. GLEBIUS-RIPN GLEB-RIPE