Skip to content

A C API to do most things done by the FreeBSD 'ifconfig' program today

License

Notifications You must be signed in to change notification settings

Savagedlight/libifconfig

Folders and files

NameName
Last commit message
Last commit date

Latest commit

1355874 · Feb 17, 2018
Apr 28, 2017
Feb 12, 2018
Jul 6, 2017
Jul 6, 2017
Sep 1, 2016
Aug 20, 2016
Aug 19, 2016
Apr 9, 2016
Sep 13, 2016
Jul 6, 2017
Jun 11, 2016
Sep 1, 2016
Feb 17, 2018

Repository files navigation

libifconfig

A C API to do most things done by the FreeBSD 'ifconfig' program today. The primary goal is to reduce code duplication and empower third-party applications. It is hoped the API will be simple enough that interacting with the network configuration becomes trivial.

FAQ

Is it ready for production use?

Absolutely not. There are currently no releases of this library, and the API may change at any time.

I want to break stuff. How do I use libifconfig?

Please see the examples directory for some simple programs using libifconfig.

How can I contribute?

Work still needs to be done in the following areas:

  • Add more features!
  • Solve tickets in the issue tracker
  • Write unit tests and system integration tests. Preferably using the tools used for tests in FreeBSD base.

Feedback on API design decisions, code quality, etc are very welcome. If your feedback comes with (or in the form of) a pull request, that's great! :)

How do I use the state object (ifconfig_handle_t)

You need to create and dispose of a state object (ifconfig_handle_t). It is the applications discretion how to use/track state objects, but only one thread should use a given state object at the same time.

Suggestion: Use one state object per thread, or use a locking mechanism to prevent multiple threads from using the same state object at the same time.

// Create a state object
ifconfig_handle_t *lifh = ifconfig_open();

if (lifh == NULL) {
    errx("Failed to open libifconfig handle.");
    return (-1);
}

// Do stuff

// Dispose of the state object
ifconfig_close(lifh);
lifh = NULL;

Mailing List Threads

2016-03-04: libifconfig: A C Api for ifconfig
2016-04-09: libifconfig: Initial code available, looking for feedback