Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| summerofcode2020projects:networkconfigurationlibraries [2020/08/25 19:28] – AhsanBarkati | summerofcode2020projects:networkconfigurationlibraries [2021/06/13 19:15] (current) – Formatting fix ChristosMargiolis | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Network Configuration Libraries ====== | ====== Network Configuration Libraries ====== | ||
| - | * Student: | + | * Student: [[/ |
| - | * Mentors: | + | * Mentors: |
| - | * [[/ | + | * [[/ |
| - | * [[/ | + | * [[/ |
| - | ===== Project description | + | ===== The Code ===== |
| - | %%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 ===== | + | https:// |
| - | 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. It is also intended that the library should be able to read the complete routing table of the system and hence simulate the netstat -r command line utility. | + | ===== Revisions |
| - | + | ||
| - | ===== Differential revisions | + | |
| ^ Differential | ^ Differential | ||
| Line 18: | Line 15: | ||
| | [[https:// | | [[https:// | ||
| - | ===== The Code ===== | + | ===== 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. | ||
| - | https://github.com/ | + | ===== Libroute ===== |
| + | |||
| + | Manual manipulation of the network routing tables is generally achieved by the '' | ||
| ===== Status of libroute ===== | ===== Status of libroute ===== | ||
| Line 27: | Line 27: | ||
| * There is a bug with the default route addition, I am currently looking into it. | * There is a bug with the default route addition, I am currently looking into it. | ||
| * The man page for libroute can be found [[https:// | * The man page for libroute can be found [[https:// | ||
| + | |||
| + | 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 '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | Example usage of library: | ||
| + | |||
| + | < | ||
| + | #include < | ||
| + | #include < | ||
| + | |||
| + | int | ||
| + | main() | ||
| + | { | ||
| + | rt_handle *h; | ||
| + | struct sockaddr *sa_dest, *sa_gateway; | ||
| + | int defaultfib, error; | ||
| + | |||
| + | // get the default FIB number | ||
| + | size_t len = sizeof(defaultfib); | ||
| + | sysctlbyname(" | ||
| + | |||
| + | // Open the libroute handle | ||
| + | h = libroute_open(defaultfib); | ||
| + | if (h == NULL) | ||
| + | printf(" | ||
| + | |||
| + | dest = " | ||
| + | gateway = " | ||
| + | | ||
| + | // convert addresses to sockaddr structs | ||
| + | sa_dest = str_to_sockaddr(dest); | ||
| + | sa_gateway = str_to_sockaddr(gateway); | ||
| + | |||
| + | // add the new route | ||
| + | error = libroute_add(h, | ||
| + | if (error == -1 ) | ||
| + | printf(" | ||
| + | |||
| + | libroute_close(h); | ||
| + | |||
| + | return (0); | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ===== Test Plan ===== | ||
| + | |||
| + | Currently the testing of the library is not done directly, but it relies on the route utility for it. During this project, we have written tests for the route utility. The tests running on the librarified route indirectly tests the library. We have plans | ||
| + | to add tests which directly tests the library. | ||
| + | |||
| + | ===== Future Work ===== | ||
| + | |||
| + | ==== Bugs ==== | ||
| + | * Modification to default route is broken. | ||
| + | * Scope of buffer overflow in '' | ||
| + | |||
| + | ==== Testing ==== | ||
| + | * A test suite for the library, written in C. | ||
| ===== Useful links ===== | ===== Useful links ===== | ||