Discussion:
Suggested extensions to python-inet_diag library
James Hulka
2015-01-13 18:30:29 UTC
Permalink
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, <***@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, <***@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
James Hulka
2015-01-20 20:51:37 UTC
Permalink
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
Post by James Hulka
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
inet_diag.c: added filter building code from socketstat (Alexey
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
inet_diag.c: added process info parsing from socketstat (Alexey
inet_diag.c: using req_v2 and specifying protocol type in header
retreiving full process path
return proc as struct
inet_diag.c: cleanup memory leaks and reformat
memory cleanup user_ent_hash
inet_diag_copy.h: unused removed
inet_diag.c: added listening states constant
added process, pid and fd getter functions
cleanup memory leaks and reformat
memory cleanup user_ent_hash
Jiri Kastner
2015-04-14 21:12:43 UTC
Permalink
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
Post by James Hulka
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
Loading...