In looking for faster way to retrieve information about open sockets on a system I stumbled across python-inet_diag.
The library is very useful however it was missing the query / filter code found in socketstat (Alexey Kuznetsov) which it seems to be based on.
I would like to propose the following patches to implement source and destination IP and port filters for the inet_diag.create function.
Best Regards,
James Hulka
socketstat_filter.patch : inet_diag.c: added filter building code from socketstat (Alexey Kuznetsov, kuznet@ms2.inr.ac.ru) added filter options to create function added create function documentation
diag_filter.h: new header file added various filter condition constants added diag_filter structure
process_info.patch : inet_diag.c: added process info parsing from socketstat (Alexey Kuznetsov, kuznet@ms2.inr.ac.ru)
req_v2.patch : inet_diag.c: using req_v2 and specifying protocol type in header retreiving full process path return proc as struct
leak_fixes.patch : inet_diag.c: cleanup memory leaks and reformat memory cleanup user_ent_hash
inet_diag_copy.h: unused removed
listening_states.patch : inet_diag.c: added listening states constant added process, pid and fd getter functions cleanup memory leaks and reformat memory cleanup user_ent_hash
After ARM architecture testing I added the following change to my suggested extensions to python-inet_diag in order to support inet_diag_req when TCPDIAG_GETSOCK and DCCPDIAG_GETSOCK are passed as socktype.
Best Regards,
James
On 13/01/15 07:30 PM, James Hulka wrote:
In looking for faster way to retrieve information about open sockets on a system I stumbled across python-inet_diag.
The library is very useful however it was missing the query / filter code found in socketstat (Alexey Kuznetsov) which it seems to be based on.
I would like to propose the following patches to implement source and destination IP and port filters for the inet_diag.create function.
Best Regards,
James Hulka
socketstat_filter.patch : inet_diag.c: added filter building code from socketstat (Alexey Kuznetsov, kuznet@ms2.inr.ac.ru) added filter options to create function added create function documentation
diag_filter.h: new header file added various filter condition constants added diag_filter structureprocess_info.patch : inet_diag.c: added process info parsing from socketstat (Alexey Kuznetsov, kuznet@ms2.inr.ac.ru)
req_v2.patch : inet_diag.c: using req_v2 and specifying protocol type in header retreiving full process path return proc as struct
leak_fixes.patch : inet_diag.c: cleanup memory leaks and reformat memory cleanup user_ent_hash
inet_diag_copy.h: unused removedlistening_states.patch : inet_diag.c: added listening states constant added process, pid and fd getter functions cleanup memory leaks and reformat memory cleanup user_ent_hash
i just tested your additions on x86_64, armv7hl and ppc64. it seems to work (tested using tuna, pss and psk), except unix sockets, which are not implemented at all.
2a18884 a74e7dc 77800c4 4277780 d99b17d 5c0e1d1
commits above i'm going to accept and push soon.
best regards jiri kastner
On Tue, 20 Jan 2015 21:51:37 +0100, James Hulka wrote:
After ARM architecture testing I added the following change to my suggested extensions to python-inet_diag in order to support inet_diag_req when TCPDIAG_GETSOCK and DCCPDIAG_GETSOCK are passed as socktype.
Best Regards,
James
tuna-devel@lists.fedorahosted.org