socket_wrapper fd passing

Andreas Schneider asn at samba.org
Tue Jan 28 07:49:55 MST 2014


On Tuesday 28 January 2014 02:54:59 Stefan  Metzmacher wrote:
> Hi Andreas,
> 
> > Changeset truncated at 500 lines:
> > 
> > diff --git a/TODO b/TODO
> > index f4b8a12..2ce46ff 100644
> > --- a/TODO
> > +++ b/TODO
> > @@ -1,3 +1,19 @@
> > -* Add recvmsg() with support for IP_PKTINFO
> > -* We might need serialization so we don't call wrapper symbols
> > recursively. -* Add logging for debug.
> > +TODO
> > +=====
> > +
> > +Library:
> > +---------
> 
> I think we also need some mutexes to protect the global linked list
> and some thread tests.

Yes, that's true.
 
> > +* Add IP_PKTINFO support for sendmsg/recvmsg.
> > +* Add support for fd passing in sendmsg/recvmsg.
> > +  Scenario:
> > +  We accept a connection from a client and need to pass the fd to another
> > +  child we forked. socket_wrapper then needs to send the 'struct
> > socket_info' +  to the child first and set it up there.
> 
> I think it would be better to handle it like accept()
> and use getpeername() and getsockname() on the received fd
> and construct the inet socket_info by converting the magic
> unix domain socket path.

Yes, we could try that.

> Then we look for an existing struct socket_info, if we find a match,
> we just add a new struct socket_info_fd, otherwise we add a new socket_info
> and socket_info_fd.
> 
> This was we only need to modify swrap_recvmsg() (or some subfunction of it)

I started to implement IP_PKTINFO and wanted to do that first cause testing it 
is much easier.

I would basically do the same for fd-passing, as

http://git.cryptomilk.org/projects/socket_wrapper.git/log/?h=recvmsg_pktinfo


	-- andreas

-- 
Andreas Schneider                   GPG-ID: CC014E3D
Samba Team                             asn at samba.org
www.samba.org



More information about the samba-technical mailing list