Coder Social home page Coder Social logo

inet-diag-example's Introduction

inet-diag-example

If you want to see a more complete example of how to use INET_DIAG, check out tcp_closer

For a project I was working on lately, I needed to passively monitor a large number of TCP sockets. One common way to do is to parse the output of /proc/tcp, but my goal was to create a "clean" solution and avoid for example text-parsing.

After doing some digging, I discovered the convenient ss-utility (of the iproute-suite), which does something similar to what I want. ss makes use of NETLINK and the INET_DIAG-sockets for a nice way of extracting connection information. ss has support for all protocols (sockets) supporting exporting information, so the code is very generic and quite large.

Combined with a lack of INET_DIAG-documentation (the kernel source is your friend), I decided to create a small, easy to follow example of how INET_DIAG can be used to passively monitor sockets. A detailed description of the example is available here.

inet-diag-example's People

Contributors

kristrev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

inet-diag-example's Issues

not found inet_diag_req_v2 in kernel 2.6.32

hi,Kristrev
I read this post Passive monitoring of sockets on Linux recently.

but in my kernel, only have inet_diag_req

is there different between inet_diag_req_v2 and inet_diag_req?

there is few information while googling it

license

Cannot I reuse this code in my project?
I would like to know the license term.
I'm happy if you add copyright notice at the head of the source code file.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.