Skip to content

Instantly share code, notes, and snippets.

@dlrobertson
Last active December 16, 2017 02:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dlrobertson/d89a2892944dae77e044ac7de07d803c to your computer and use it in GitHub Desktop.
Save dlrobertson/d89a2892944dae77e044ac7de07d803c to your computer and use it in GitHub Desktop.
netcfg

Summary

netcfg is a method for configuring and managing network interfaces. The goal is to provide an intuitive "back-end" for doing so. After the "back-end" is created a configuration daemon should be created that provides a user interface, reading the configuration supplied from file and then using the utilities detailed here to "push" the configuration.

Motivation

The immediate motivation for changing the method of configuring network interfaces are as follows.

  • We need to be able to handle multiple interfaces.
  • Handling of interfaces configured to use DHCP is currently non-functional.
  • No method to change interface IP addresses or the gateway IP.

Once IPv6 is supported, the situation is expected to become more complex.

Initial Requirements

  • adding/removing IPv4 addresses
  • adding/removing the IPv4 gateway
  • adding/changing the mac address
  • setting the interface up/down
  • return a list of all neighbors (ARP cache).
  • ability to "listen" for a change in one of the above

Desired architecture

                  __________      ________________
 ----------      |  Config  |    |    Network     |
| Smolnetd | <-> | Protocol | <- |     Config     |
 ----------       ----------     | Application(s) |
                      ^          |    (dhcpd)     |
                      |           ----------------
                 _______________
                |   Desktop     |
                |     GUI       |
                |  Displaying   |
                |   Interface   |
                | Configuration |
                 ---------------

Option 1

Summary

Create a scheme under network:netcfg that contains endpoints for each of the options to configure for each interface.

Design

The design proposed here is quite simple. Create netcfg which contains a path for each network interface id. Each of these paths contain a endpoint for mac, flags, ipv4/addrs, ipv4/neighbors, and ipv4/routes.

network:netcfg
├── 0
│   ├── mac
│   ├── flags
│   └── ipv4
│       ├── addrs
│       ├── neighbors
│       └── routes
└── 1
...

Advantages

  • The simplicity of this design makes it the most intuitive of the two.

Drawbacks

  • As the number and complexity of routes increase, we're placing a greater burden on the end-user to keep the format of the "file" correct (Think /etc/passwd).
  • We do not have the ability to return errors to the user. For example, we cannot inform a user that the address they provided was malformed.
  • The addition of IPv6 will make this a bit more complex due to the increased complexity of default routes.

Option 2

Summary

Create a scheme endpoint under network:netcfg that loosely adheres to the netlink protocol, in particular RFC 3549 § 2.3.3.2.

Desgin

TODO(@dlrobertson)

Advantages

  • The addition of error messages may make this nice for advanced users
  • Users do not need to worry about keeping the format of the "file" correct.

Drawbacks

  • Create new socket type with a new binary protocol.
  • Far from intuitive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment