Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Dec 2004 16:07:15 +0300
From:      Gleb Smirnoff <glebius@freebsd.org>
To:        dvoinikov@kazna.ru
Cc:        freebsd-net@freebsd.org
Subject:   Re: Divert sockets no longer behave like connected (SS_ISCONNECTED is removed from so->so_state)
Message-ID:  <20041216130715.GA65090@cell.sick.ru>
In-Reply-To: <1716213283.20041216094917@kazna.ru>
References:  <1716213283.20041216094917@kazna.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041216130715.GA65090>