[OpenAFS-devel] Progress on Linux in-kernel RxRPC library

Kyle Moffett mrmacman_g4@mac.com
Mon, 21 Mar 2005 00:20:30 -0500


On Mar 20, 2005, at 23:40, Derrick J Brashear wrote:
> On Sun, 20 Mar 2005, Kyle Moffett wrote:
>> Why do you need the Kerberos credentials?  As I understand it, for 
>> any given
>> RxRPC connection, all you need is the OpenAFS token, nothing more.  I 
>> envision
>> a "linuxklog" tool that basically does this:
>
> An AFS token is just a Kerberos "afs" credential with some stuff 
> stripped out,
> today. Sooner or later the stuff won't even be stripped out. At that 
> point,
> why have 2 copies of the ticket?

Then your "linuxklog" program would only need to make sure that you 
have the AFS
service key in Kerberos form, then if it isn't in the kernel because 
you're
using an old Kerberos, just put it there.

> If I have to have 2 copies now, well, I can already do that, and it's 
> free: the
> code already exists and has been in service forever.

You don't _have_ to use the Linux code, but it's available when/if you 
think it's
mature enough and provides enough functionality that you think it's 
worthwhile.
At this point, I agree with you that it isn't, but I'm working to make 
it better.

Changing topics:

At the moment I'm creating a userspace interface so an RxRPC call using 
the kernel
routines is something like this.  The design is still incomplete, so 
I'm not sure
about the exact appropriate usage of the sendmsg/recvmsg/readv/writev 
calls or the
proper method to pack the data and ancillary info in the msghdr.  I am 
interested
in your feedback and if you think this is a viable method to interface 
RxRPC from
userspace to kernelspace.

/*
  * NOTE: This is a _single_ RPC call.  The kernel would automatically 
pack up to
  * four calls into the same connection if using the same credentials.
  */
sock = socket(AF_INET, SOCK_RXRPC);
setsockopt(sock, SOL_SOCKET, SO_SECURITY, binary_security_info, 
sec_size);
connect(sock, my_sockaddr_in, sockaddr_size);
sendmsg(sock, rpc_data_packed_into_msghdr, 0);
recvmsg(sock, rpc_result_packed_into_msghdr, 0);
recvmsg(sock, rpc_more_result_packed_into_msghdr, 0);
close(sock);


/*
  * This is a server.  A single RxRPC socket in listen() mode maps to an 
arbitrary
  * number of connections in the kernel.
  */
sock = socket(AF_INET, SOCK_RXRPC);
bind(sock, my_sockaddr_in, sockaddr_size);
listen(socket, 20);
while(0 <= (call = accept(sock, my_sockaddr_in, sockaddr_size))) {
	
	/* If desired, create/manage multiple threads/processes here. */
	
	/* Implement the RPC */
	getsockopt(sock, SOL_SOCKET, SO_SECURITY, bin_security_storage, 
sec_size);
	recvmsg(sock, rpc_data_msghdr, 0);
	sendmsg(sock, rpc_result_msghdr, 0);
	close(sock);
}

The sockets would also support select(), poll(), read(), write(), etc

Cheers,
Kyle Moffett

-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCM/CS/IT/U d- s++: a18 C++++>$ UB/L/X/*++++(+)>$ P+++(++++)>$
L++++(+++) E W++(+) N+++(++) o? K? w--- O? M++ V? PS+() PE+(-) Y+
PGP+++ t+(+++) 5 X R? tv-(--) b++++(++) DI+ D+ G e->++++$ h!*()>++$ r  
!y?(-)
------END GEEK CODE BLOCK------