Thread (21 messages) 21 messages, 8 authors, 2009-12-03

Re: RFC: net 00/05: routing based send-to-self implementation

From: Benjamin LaHaise <hidden>
Date: 2009-11-30 20:04:26

On Mon, Nov 30, 2009 at 11:37:31AM -0800, Ben Greear wrote:
This doesn't work if you want to have one application manage lots of 
interfaces and send traffic between these interfaces.  Certainly there are 
use-cases that can use multiple name-spaces, but it's nice to have the 
option not to use them as well.
Actually, it's quite doable from within one application.  An application 
I recently adapted to make use of multiple network namespaces within a single 
process by way of pthreads and unshare(CLONE_NEWNET).  The scheme I used 
is to just open the socket in a new namespace in a thread.  Since the 
file descriptor table is still shared, it's easy to send/receive data from 
any other thread, regardless of which virtual network namespace it's in.  
All told, setting up virtual routers with namespaces is pretty easy.

		-ben
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help