Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1373591

How to get creatior PID information for the local tcp connection

From Vishnu Pratap Singh <vishu13285@gmail.com>
Newsgroups linux.kernel
Subject How to get creatior PID information for the local tcp connection
Date 2016-04-07 19:40 +0200
Message-ID <rlm4p-7rS-1@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


Hi,


Issue -  How to get PID information for the local tcp connection



i want to get the creator PID for each socket in user space for local
tcp connection, i see in kernel there is support for returing PID with
"SO_PEERCRED" ioctl to work across namespaces. it uses struct pid and
struct cred to store the peer credentials on struct sock.
cred_to_ucred(sk->sk_peer_pid, sk->sk_peer_cred, &peercred); Above
function stores the PID information in ucred->pid = pid_vnr(pid); and
same is returned via "SO_PEERCRED" ioctl .

But for local tcp connection i get pid as 0, is there any way i can
get the PID information. Any help or suggestion will be highly
helpful.



BR,

Vishnu<div id="DDB4FAA8-2DD7-40BB-A1B8-4E2AA1F9FDF2"><br />
<table style="border-top: 1px solid #aaabb6;">
	<tr>
        <td style="width: 55px; padding-top: 13px;"><a
href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail"
target="_blank"><img
src="https://ipmcdn.avast.com/images/2016/icons/icon-envelope-open-tick-round-orange-v1.png"
/></a></td>
		<td style="width: 470px; padding-top: 15px; color: #41424e;
font-size: 13px; font-family: Arial, Helvetica, sans-serif;
line-height: 18px;">Virus-free. <a
href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail"
target="_blank" style="color: #4453ea;">www.avast.com</a>
		</td>
	</tr>
</table><a href="#DDB4FAA8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width="1"
height="1"></a></div>

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

How to get creatior PID information for the local tcp connection Vishnu Pratap Singh <vishu13285@gmail.com> - 2016-04-07 19:40 +0200
  Re: How to get creatior PID information for the local tcp connection Eric Dumazet <eric.dumazet@gmail.com> - 2016-04-07 20:30 +0200
    Re: How to get creatior PID information for the local tcp connection Eric Dumazet <eric.dumazet@gmail.com> - 2016-04-07 20:40 +0200

csiph-web