Hi! On 11:34 Mon 06 Apr , Haibin Wang wrote: > Hi folks, > > A question on how to get the current network namespace. > > I am porting a driver from 2.6.18 to 2.6.28. We do protocol analysis > by the 5 tuples: src IP, dst IP, src port, dst port and transportation > protocol. We have code in usr space to pass in these parameters, then > kernel space code do search through udp_hash and tcp_hash to locate > the exact socks. Since 2.6.18 doesn't support network namespace, this > works fine. > > But as 2.6.28 supports network namespace, search through udp_hash and > tcp_hash requires a sixth parameter -- network namespace as well. So > the question is, how to get current network namespace in this case? Is > it available from user space code and passed to kernel code, or there > is function to get it in kernel space? > > It seems I could go by by using the system init_net, but I want to be > new feature friendly at least. Netmark namespace means that different user space processes have a different view of the network (used e.g. by vservers). I do not know what will happen, if you pass the init_net (default namespace), if the socket is created in a different namespace. -Michi -- programing a layer 3+4 network protocol for mesh networks see http://michaelblizek.twilightparadox.com -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ