OONF Configuration

From OLSR.org Wiki
Jump to: navigation, search

The OLSR.org Network Framework has a simple structured configuration system where different sources of configuration are put together and processed by the same code.

Structure

The basic structure of configuration options in OONF is a group of sections, each of them containing key/value pairs.

Sections exist in two variants, with names and without names. If a configuration section demands a name, the unnamed variant can be used to set defaults for all named configuration sections of the same type.

Section types have alphanumeric names including and underscore, but they cannot start with a number (for pattern matching fans: [a-zA-Z_][a-zA-Z0-9_]*).

Section names can use any printable character, but some configuration formats limit the characters or demand you use an escape sequence.

Keys contain the same characters as Section types.

Values can contain any character, but (again) you might need to escape some of them. Typically configuration values should not contain multiple lines.

Some Keys allow multiple values. Most configuration formats support this by allowing the user to set the same Key multiple times.

Configuration Sections

There are three configuration Sections that are not directly tied to plugins.

Two are provided by the OONF Core itself, global and log. There is also the interface configuration section that is used by multiple plugins like the OONF RFC5444 Plugin and the NHDP Plugin.

Each OONF Plugin can also provide one or multiple configuration Sections. Most of these Sections have the same name as the plugin, but some plugins also extend existing Sections of other plugins.

log and global are unnamed configuration section, the interface configuration section needs the name of the network interface.

The log configuration section is explained on the OONF Logging site.

The global configuration section

The global configuration section has six settings. It controls the basic behavior of the OONF core.

Key Type Default
fork BOOL false
failfast BOOL false
pidfile STRING
lockfile STRING
plugin list of STRING
plugin_path STRING

fork is a boolean setting telling the OONF application to fork into a background process.

failfast is another boolean setting which can activate an error during startup if a requested plugin does not load or an unknown configuration variable is set.

pidfile is used together with the fork option to store the pid of the background process in a file.

lockfile creates a file on disk and keeps a lock on it as long as the OONF application is running to prevent the application from running multiple times at once.

plugin is a list of dynamic plugins that should be loaded at startup. You don't need to put static linked plugins into this setting.

plugin_path is a folder in the filesystem where OONF will (in addition to the usual places) look for the shared library files of dynamic plugins.

You can look up the exact settings by using the --schema command line option:

./olsrd2_static --schema=global

Configuration Types

There are several types of configuration built into the OLSR.org Network Framework. Plugins can use these types in their configuration options or define their own types.

The integrated types are

Formats

The configuration format is handled by a Plugin. All plugins support reading configuration files, some might also support generating configuration files.

At the moment there are two configuration format plugins:

  • cfg_compact defines a simple text based configuration format similar to the Windows .INI files. It supports reading and generating configuration files.
  • cfg_uciloader uses the OpenWRT UCI library to read the UCI files directly without conversion.

How to set configuration options?

There are three major ways to manipulate configuration options. You can mix all three of them.

By sending a SIGHUP to the OONF process you tell the program to process all configuration related command line options, including the ones loading configuration files.

Command line options

There are a couple of command line parameters to directly manipulate the configuration database of OONF.

./oonf_static --set log.debug=timer

Configuration files

There is also a command line parameter to ask a configuration format plugin to read a block of configuration, mostly from a file.

./oonf_static --load /etc/oonf.cfg

Each plugin registers an URL-like protocol name that can be used to select the configuration format if multiple plugins are active.

./olsrd_static --load uci:///etc/config/olsrd2

Plugins

The Remotecontrol Plugin allows the user to query and update the configuration during runtime through the OONF Telnet Plugin.