Giter Club home page Giter Club logo

libnetlink-examples's Introduction

libnetlink examples

This repo includes 3 example utilities using libnetlink to do the same operations you can do with the iproute2 'ip' command. You typically want to do this when embedding network operations in your own application (e.g your C application needs to create a macvlan) and you don't want to use ugly system() calls to the ip command. Not to mention calling system() on a multi-threaded application is looking for trouble :)

You will need the rpm package iproute-devel installed, or an equivalent package for your distribution. This is the package that ships libnetlink.a, the library required to compile this repo. To compile just type make

The repo provides 3 example applications:

addvlan

Usage: addvlan <device> <name>

This is the same as ip link add link <device> <name> type macvlan

rmif

usage: rmif <device>

This is the same as ip link delete <device>

ifstate

usage: ifstate <device> [up|down]

This is the same as ip link set <device> up|down

More info:

If you need information about what other parameters/commands are available, you can always browse the iproute2 repo: https://github.com/shemminger/iproute2

The code there is nicely organized

libnetlink-examples's People

Contributors

moises-silva avatar

Watchers

 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.