Get current network namespace

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Would appreciate your valuable inputs.

Haibin

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux