[REVIEW REQUEST] recvmsg in socket_wrapper

Andreas Schneider asn at samba.org
Mon Jan 20 14:30:17 MST 2014


On Monday 20 January 2014 21:10:48 Stefan  Metzmacher wrote:
> Hi Andreas,
> 
> >>> http://git.cryptomilk.org/projects/socket_wrapper.git/log/?h=recvmsg
> >> 
> >> Thanks! It's nice to see that my work is finally finished:-)
> >> 
> >> However I don't see were you transfer the 'struct socket_info'
> >> transparently while doing fd-passing. Otherwise it's not possible to
> >> pass socket fds across to another process.
> > 
> > Well, the fd-passing is handled in the kernel. I can't fake the kernel
> > internals here :) That's why you can only pass fds on the local system
> > over
> > unix sockets.
> 
> We need be able to test fd-passing of AF_INET/AF_INET6 sockets
> from one process to another process on the same system, while
> passing it over a AF_UNIX socket between the two processes.
> and getpeername() and getsockname() need to return the same
> in both processes.

Ok, so in swrap_sendmsg_before() we need to either send a special packet first 
or we add cmsg structure to msg_control.
In swrap_recv_before() we read the information, allocate a socket info 
structure and fill it.


> 
> We may need to pass more additional stuff via the socket
> and hide it from the caller.
> 
> We need that for 2 things:
> 
> - dcerpc association group support with a prefork process model
>   any process accepts an incoming connection and looks at
>   the assoc_group_id field in the dcerpc bind request,
>   if it's not 0, it indicates the wish to join an existing
>   association. Then we need to hand over the connection
>   to the process that already handles the association.
> 
> - smb 3.0 multi-channel uses a similar model, there we need to
>   look at the client_guid in the negprot request and hand over
>   the connection to the smbd process that already handles that
>   client (if there's already such a process).
> 
> >> Otherwise I think it looks good, can you also backport this
> >> to the current samba socket_wrapper code, I'd like to have that
> >> also more or less complete before we remove/replace it with your
> >> new code.
> > 
> > I can take a look.
> 
> Thanks!
> 
> metze

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



More information about the samba-technical mailing list