ifstated.conf man page on OpenBSD

Man page or keyword search:  
man Server   11362 pages
apropos Keyword Search (all sections)
Output format
OpenBSD logo
[printable version]

IFSTATED.CONF(5)	  OpenBSD Programmer's Manual	      IFSTATED.CONF(5)

NAME
     ifstated.conf - Interface State daemon configuration file

DESCRIPTION
     The ifstated(8) daemon runs commands in response to network state
     changes, which it determines by monitoring interface link state or
     running external tests.  ifstated.conf is the configuration file for this
     daemon.

SECTIONS
     The ifstated.conf config file is divided into three main sections.

     Global Configuration
	   Global settings for ifstated(8).

     Macros
	   User-defined variables may be defined and used later, simplifying
	   configuration.  Macros must be defined before they are referenced
	   in ifstated.conf.

     State Definitions
	   Definitions of states and transitions.

GLOBAL CONFIGURATION
     init-state state
	     Set the initial state to state instead of using the first state
	     defined.

MACROS
     Macros can be defined that will later be expanded in context.  Macro
     names may not be reserved words like, for example state or run.  Macros
     are referenced with a shell-like notation as $macro.  Macros are usually
     used to define tests for state transitions like interface link state or
     external tests.

     Currently an interface can have three different link states:

     up	       The physical link of the interface is up.  For carp(4)
	       interfaces this equals the master state.
     down      The physical link of the interface is down.  For carp(4)
	       interfaces this equals the backup state.
     unknown   The physical link of the interface is unknown.  This is because
	       the interface driver does not provide information of the
	       physical link state.  For carp(4) interfaces this equals the
	       init state.

     In contrast to link state tests, external tests must be run periodically
     to evaluate their status.	The frequency at which an external test is run
     has to be set with the every keyword.

     For example:

	   carp_up = "carp0.link.up && carp1.link.up"
	   net = '( "ping -q -c 1 -w 1 192.168.0.1 > /dev/null" every 10 && \
		    "ping -q -c 1 -w 1 192.168.0.2 > /dev/null" every 10 )'

TESTS AND EVENTS
     ifstated(8) delegates the process of testing to libevent which associates
     a value with every test, in this case true or false.  Whenever the value
     of a test associated with the current state changes, an event is
     triggered and the state's body is processed.

STATE DEFINITIONS
     ifstated(8) operates on a finite state machine with states and
     transitions.

     Each state consists of an init block and a body.  The init block is used
     to initialise the state and is executed each time the state is entered.
     The body of a state is only executed when that state is the current state
     and an event occurs.

     The action taken within a certain state is typically made dependent on
     the evaluation of one or more if statements.  Possible actions include
     executing commands using the run statement, or triggering a state
     transition with the set-state keyword.  It is also possible to write
     multiple nested if blocks.

     For example:

	   state one {
		   init {
			   run "ifconfig carp0 advskew 10"
			   run "ifconfig carp1 advskew 10"
		   }

		   if ! $net
			   set-state two

		   if ! $carp_up {
			   run "ifconfig carp0 advskew 254"
			   run "ifconfig carp1 advskew 254"
			   set-state three
		   }
	   }

GRAMMAR
     Syntax for ifstated.conf in BNF:

     grammar	     = entry grammar | entry

     entry	     = global_config | varset | action | state

     global_config   = initstate
     initstate	     = "init-state" string

     varset	     = string "=" string

     action_list     = action [ action_list ]
     action	     = "run" string | "set-state" string |
		       "if" expr action_block
     action_block    = "{" action_list "}" | action
     expr	     = "!" expr | expr "&&" expr | expr "||" expr | term
     term	     = if_test | ext_test | "(" expr ")"
     if_test	     = string ".link." ( "up" | "down" | "unknown" )
     ext_test	     = string "every" number

     state	     = "state" string "{" stateopt_list "}"
     stateopt_list   = stateopt [ stateopt_list ]
     stateopt	     = init | action
     init	     = "init" action_block

FILES
     /etc/ifstated.conf	 ifstated(8) configuration file

SEE ALSO
     carp(4), pf(4), ifstated(8)

HISTORY
     The ifstated.conf file format first appeared in OpenBSD 3.8.

OpenBSD 4.9		       October 25, 2007			   OpenBSD 4.9
[top]

List of man pages available for OpenBSD

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net