netconf

design overview

Debian DevRoom, FOSDEM 2008, Brussels, Belgium 23 Feb 2008

What is netconf?

Homepage: http://netconf.alioth.debian.org/

What's in this talk?

What about the name?

netconf could also be:

I don't insist on the name, but I don't see too much of a conflict.

The menu

Motivation

What about NetworkManager?

The netconf vision

netconf goals

Desired functionality

A roadmap for netconf 1.0 is in the (Git) repository.

Selected items:

Broken drivers

OpenSolaris "Network Auto-Magic"

http://opensolaris.org/os/project/nwam

netupdown

http://lists.debian.org/msgid-search/47B85EE0.5000002@fpt.com.vn

The menu

netconf design

The big picture

Example: bringing up an interface with DHCP on Debian

  1. user calls ifup eth0, which issues an IFUP event via the control socket.
  2. the control socket handler dispatches the event to the interface policy.
  3. the interface policy consults /etc/network/interfaces, determines that DHCP is to be used, and instantiates and delegates control to a DHCPHandler.
  4. the DHCPHandler spawns dhclient and registers its stdout with the core along with a reactor callback.

Continued: bringing up an interface with DHCP on Debian

  1. dhclient now issues PREINIT and BOUND events, which are split by the reactor callback into component calls to the interface manipulator.
  2. the manipulator populates the environment and spawns shell scripts to do the actual work.
  3. should dhclient fail to obtain a lease, it will issue a FAIL or TIMEOUT event.
  4. The policy might tell netconf to then fire off zeroconf.

Example: bringing down a DHCP-configured interface on Debian

  1. user calls ifdown eth0, which issues an IFDOWN event via the control socket.
  2. the control socket handler dispatches the event to the interface policy.
  3. the interface policy finds that there is already a handler assigned to eth0 and tells it about the IFDOWN event.
  4. the previously instantiated DHCPHandler kills dhclient and takes the interface down.
  5. on success, the policy deletes the handler instance for eth0.

Questions so far?

The big picture

The main event loop

A design document is available online.

Main loop (simplified pseudo code):

while _is_running:
    fds = select(fdrreactors, [], [], timeout=None)
    for fd in fds[0]:
        fdrreactors[fd].react_to(READ, fd, self)

Reactor registration:

def register_fdrreactor(fd, reactor):
    fdrreactors[fd] = reactor
def unregister_fdrreactor(fd):
    del fdrreactors[fd]

Thread-less and cooperative reactors

The job queue runner

def __call__(self, *args, **params):
  if self.all_done():
      return self._do_callback_or_raise()
  return self._get_next_job()(*args, **params)

Example: ifup

self._workqueue_runner.add_job(run_preup_hooks)
self._workqueue_runner.add_job(run_handler)
self._workqueue_runner.add_job(run_postup_hooks)

The policy

user-defined, per-interface policy (+ a default) used to e.g.

Policy example #1

# /etc/netconf/interfaces.d/default
[IFUP]
allow @group1 user2
startat ENI

[cfg ENI]
file /etc/network/interfaces
NOTFOUND DHCP

[cfg DHCP]
dhcp-client-param1 foobar
FAIL,TIMEOUT LinkLocal

#[cfg LinkLocal]
#nothing here

Policy example #2

# /etc/netconf/interfaces.d/tun0
[IFUP]
allow @users
prereq ifup eth0
startat OpenVPN

[cfg OpenVPN]
config /etc/openvpn/work.cfg
BIND ENI

[cfg ENI]
file /etc/network/interfaces.d/tun0
#NOTFOUND error #(default)

Methods

Statelessness

Example: stateless handling

Imagine:

The result:

The menu

Implementation

Outlook: wanted features

Current status

Roadmap

Thank you

Thank you for your attention!

Now heckle! Then join!

Licence

These slides, their design, and the content are © Martin F. Krafft and released under the terms of the CC by-nc-sa 2.5 licence.

reStructuredText sources: slides.rst and ui/netconf/*.

Slides based on the S5 presentation system.