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

Re: PID of process that owns TCP Socket



<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

> Any help will be appreciated.
> 
> Thanks,
> 
> Vishwas
> 
> --
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive:       http://mail.nl.linux.org/kernelnewbies/
> FAQ:           http://kernelnewbies.org/faq/
> 
> 

-- 
Eugene TEO -  <eugeneteo%null!cc!uic!edu> <http://www.anomalistic.org/>
1024D/14A0DDE5 print D851 4574 E357 469C D308  A01E 7321 A38A 14A0 DDE5
main(i) { putchar(182623909 >> (i-1) * 5&31|!!(i<7)<<6) && main(++i); }


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/