This is an old revision of the document!
Network Configuration Libraries
- Student: Ahsan Barkati (ahsanb@FreeBSD.org)
- Mentors:
- KristofProvost (kp@freebsd.org)
- TomJones (thj@freebsd.org)
Project description
FreeBSD has high quality tools for management of the network, which includes tools to configure and manage interfaces, the firewalls and more. However these tools are not available as libraries, any software that wishes to incorporate network management must shell out to the command line tools. This limits the range of possible tools for automating control of a FreeBSD system. The aim of this project is to develop libroute, a library with APIs to manage routes.
Libroute
Manual manipulation of the network routing tables is generally achieved by the /sbin/route utility. It provides functionality to add, flush, change, show the routes along with optional modifiers which enable setting some initial parameters to the routes such as RTT, MTU etc. This project aims to create a library which brings in a method to programmatically manage the routing. This library will allow addition of the routes to the FIB and also a method to change a particular route, delete a route or even flush the whole routing table.
Status of libroute
The current status of the libroute library is as follows:
- It can be used to add, delete, change and get routes for both IPv4 and IPv6.
- There is a bug with the default route addition, I am currently looking into it.
- The man page for libroute can be found here.
The general design of libroute is primarily characterized by the use of a handle. The library provides a method to get a libroute handle (via the libroute_open() API) and all the functionalities of the library is accessed by making use of this handle. The handle stores the FIB number on which it will operate and the socket that it will use to communicate with the kernel. At any point of time, this FIB number can be modified using the libroute_setfib() API. At the end this handle needs to be closed and this will free the memory held by the handle. There are various functions that this library provides:
- libroute_modify()
- libroute_add()
- libroute_change()
- libroute_delete()
- libroute_get()