GithubHelp home page GithubHelp logo

netlink's Introduction

Build Status

netlink-rs

This project aims at providing building blocks for the netlink protocol (see man 7 netlink).

The netlink protocol is huge but the some subprotocols are widely used:

  • the generic netlink protocol, used to create custom IPCs
  • the rtnetlink protocol (see man 7 rtnetlink), for manipulating the network stack
  • the audit protocol to interact with Linux audit system
  • the sock_diag protocol (see man 7 sock_diag) to monitor sockets

Organization

  • the netlink_sys crate provides netlink sockets. Integration with mio and tokio is optional.
  • Each netlink protocol has a netlink-packet-<protocol_name> crate that provides the packets for this protocol:
  • the netlink-packet-core is the glue for all the other netlink-packet-* crates. I provides a unique NetlinkMessage<T> type that represent any netlink message for any sub-protocol.
  • the netlink_proto crate an asynchronous implementation of the netlink protocol. It only depends on netlink-packet-core for the NetlinkMessage type and netlink-sys for the socket.
  • the rtnetlink crate provides higher level abstraction for the route protocol (see man 7 rtnetlink). This is probably what users want to use, if they want to manipulate IP addresses, route tables, etc.
  • the audit crate provides higher level abstractions for the audit protocol.

Other netlink projects in rust

Other non-rust netlink projects

  • libnl: netlink implementation in C. Very complete with awesome documentation.
  • pyroute2: a very complete and readable implementation in pure python.
  • netlink: a very complete and very actively maintained go project, seems to be widely used.

Credits

My main resource so far has been the source code of pyroute2 and netlink a lot. These two projects are great, and very nicely written. As someone who does not read C fluently, and that does not know much about netlink, they have been invaluable.

I'd also like to praise libnl for its documentation. It helped me a lot in understanding the protocol basics.

The whole packet parsing logic is inspired by @whitequark excellent blog posts (part 1, part 2 and part 3, although I've only really used the concepts described in the first blog post). These ideas are also being used in @m-labs's smoltcp project.

Thanks also to the people behing tokio, especially @carllerche, for the amazing tool they are building, and the support they provide. The project structure and code quality are mind blowing, and some parts of this projects are basically rip-offs from tokio's source code

Finally, thanks to the Rust community, which helped me on multiple occasions

Other resources I particularly appreciated:

netlink's People

Contributors

dequbed avatar ebkalderon avatar idanski avatar little-dude avatar markpash avatar mhristache avatar pinkisemils avatar surban avatar

Watchers

 avatar  avatar

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.