How to add PID in /proc/net/udp6 in linux kernel 4.14

tushar9188

New Member
Joined
Dec 23, 2022
Messages
1
Reaction score
0
Credits
15
I was working on a project on a platform using linux kernel 4.14 and that project requires PID of processes alongwith the port numbers, as I can see, that in linux kernel 2.6.32, PID of processes is stored in /proc/net/udp6 but this data has been removed in 4.14 kernel, there is a structure called sock which contains a field called pid in kernel 2.6.32, but in 4.14 kernel, there is no such field, so another question which comes is, is it even possible to have PIDs of processes in kernel 4.14?
p.s. - sock structure in kernel 4.14 has another field called sk_peer_pid of type pid, is this the same thing as was in linux kernel 2.6.32...
 


It appears that the /proc/net/udp* files:
Hold(s) a dump of the UDP socket table. Much of the information is not of use apart from debugging.
which means that the file is not one in which the user is likely able to echo a variable into to change live functioning of the system, such as one might for example echo 1 into /proc/sys/net/ipv4/ip_forward to change behaviour. See: https://stackoverflow.com/questions/23753306/meaning-of-fields-in-proc-net-udp.

That observation was made in 2014, about the time of the release of the 3.10 kernels, with the 2.6.32 kernels still ubiquitous even though they were released around 2010. I can't say what the 2.6.32 kernel had enabled for /proc/net/udp6 because it's too long ago, but whatever it was, by 2014, the /proc/net/udp* files it seems were informational rather than manipulable or usefully alterable, if they ever were. What was the case in 2014 is actually similar to what the case is today for the /proc/net/udp* files. The output shown in the stackoverflow link above is the same sort of information in current kernels of the 5 and 6 versions.

In the /proc/net/netlink file you will see sk values and PID values which may be of some use for your project.
 
This sounds like homework or coursework. If that is the case, you should be asking your teacher or course coordinator these questions, or working them through yourself.

Chris Turner
wizardfromoz
 

Members online


Latest posts

Top