Re: PID of process that owns TCP Socket

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

 



On Fri, 2004-03-05 at 05:51, Eugene Teo wrote:
> <quote sender="Vishwas Raman">
> > Hi all:
> > 
> > This is what I would like to do: I have written a module that intercepts 
> > all incoming and outgoing TCP packets using the netfiltering hooks 
> > provided by the networking stack. Is there some way of getting at the 
> > PID of the process that owns the socket from the TCP packets (sk_buff 
> > structures) that I intercept? I know I can get to the INET socket 
> > structure (struct sk) and hence its corresponding BSD socket (struct 
> > socket), but how do I get to the process pid from there?
> 
> current->pid

I think u will not get the pid using "current->pid" from 
netfilter module. You need to device some other method...

Netfilter doesn't works in the process context, it's in the
kernel space.

Since netfilter is not working in the process context, I 
dont think there will be a mechanism to find the pid of 
the user who handling the socket. 

If there is any pls let me know.... :-)


Regards,
Shine Mohamed
-- 
Shine Mohamed Jabbar <shinemohamed_j@naturesoft.net>
Naturesoft www.nature-soft.com


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           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