Giter VIP home page Giter VIP logo

nlmon's Introduction

nlmon

Simple example of how to use libnl and libev to monitor kernel netlink events. Beware, there's a lot of boiler plate code you might not need.

Building

To build and use nlmon, you need the libnl and libev libraries. On Debian/Ubuntu and Linux Mint, the following command installs the required development libraries and their runtime equivalents:

sudo apt install libnl-route-3-dev libnl-3-dev libev-dev

Provided the code of this project is cloned to ~/nlmon, do:

cd ~/nlmon
gcc -o nlmon  nlmon.c -I/usr/include/libnl3 -lnl-3 -lnl-route-3 -lev

or type make to let it call GCC for you.

Testing

In one terminal window, run nlmon:

./nlmon -v

In another terminal window, create and delete a VETH pair:

sudo ip link add veth1 type veth peer name veth1-peer
sudo ip link del veth1

There should be output from nlmon in the first window:

./nlmon -v
nlmon: veth iface veth1 deleted
nlmon: veth iface veth1-peer deleted
nlmon: veth iface veth1-peer added
nlmon: veth iface veth1 added

Origin & References

This project is based on a deprecated external netlink plugin for the finit init system. It was developed by various people at Westermo over the years. It has since been replaced by a native plugin.

Brought back to life by Joachim Wiberg for use as an example of how to utilize libnl and libev.

nlmon's People

Contributors

troglobit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

binrick legale

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.