From owner-freebsd-net@FreeBSD.ORG Thu Dec 16 13:07:19 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 6BA9A16A4CE for ; Thu, 16 Dec 2004 13:07:19 +0000 (GMT) Received: from relay.bestcom.ru (relay.bestcom.ru [217.72.144.5]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8099B43D2F for ; Thu, 16 Dec 2004 13:07:18 +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 iBGD7GZg018520 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Thu, 16 Dec 2004 16:07:16 +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 iBGD7Fpi065224 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 16 Dec 2004 16:07:16 +0300 (MSK) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.sick.ru (8.12.11/8.12.11/Submit) id iBGD7Fre065223; Thu, 16 Dec 2004 16:07:15 +0300 (MSK) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.sick.ru: glebius set sender to glebius@freebsd.org using -f Date: Thu, 16 Dec 2004 16:07:15 +0300 From: Gleb Smirnoff To: dvoinikov@kazna.ru Message-ID: <20041216130715.GA65090@cell.sick.ru> Mail-Followup-To: Gleb Smirnoff , dvoinikov@kazna.ru, freebsd-net@freebsd.org References: <1716213283.20041216094917@kazna.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <1716213283.20041216094917@kazna.ru> 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: freebsd-net@freebsd.org Subject: Re: Divert sockets no longer behave like connected (SS_ISCONNECTED is removed from so->so_state) 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: Thu, 16 Dec 2004 13:07:19 -0000 On Thu, Dec 16, 2004 at 09:49:17AM +0500, ??????? ????????? wrote: ?> I'm having this application (VPN daemon) which ?> uses divert sockets for sending stuff http://www.targeted.org/nest/ ?> It worked fine under 5.3-RELEASE but broke after ?> recent upgrade to FreeBSD 5.3-STABLE. ?> ?> An attempt to send() via divert socket now returns ?> EDESTADDRREQ "Destination address required". Digging ?> up the CVS revealed this: ?> http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/netinet/ip_divert.c ?> Quote: ?> > Revision 1.98.2.1 / (download) - annotate - [select for diffs], Tue Nov 23 15:30:02 2004 UTC (3 weeks ago) by glebius ?> > Branch: RELENG_5 ?> > - Since divert protocol is not connection oriented, remove SS_ISCONNECTED flag ?> > from divert sockets. ?> ?> Also relevant is this message by Gleb Smirnoff: ?> http://www.freebsd.org/cgi/getmsg.cgi?fetch=50544+0+/usr/local/www/db/text/2004/freebsd-net/20041121.freebsd-net ?> Quote: ?> > 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. ?> ?> Well, I'm having one - my application stopped working. I'm sorry that this change hurt you. I didn't have possibility to find all divert(4) consumers. ?> Also, quote from man divert: ?> ?> > Packets are written as either incom- ?> > ing or outgoing: if write(2) or send(2) is used to deliver the packet ?> > ... skip ... ?> > then the packet is treated as if it were outgoing Yes. sosend() catches this case before entering protocol specific send method. I should update manpage. ?> My case exactly, but this no longer holds. ?> ?> What am I supposed to do now ? Modify my application ? Actually I already ?> did that, by switching to sendto(), but just wanted to make sure this ?> divert sockets semantics change is intented and not spontaneous. It was intended. Actually the protocol is not connection-oriented and addr should be supplied with each write. This was not a-clean-up-only change. We have a kernel module - ng_ksocket, which ignores destaddr for connected sockets. This lead to some problems because in divert the address is actually required. -- Totus tuus, Glebius. GLEBIUS-RIPN GLEB-RIPE