FarSync Drivers

FarSync Line State Monitor (farnetd)

The FarSync farnetd daemon is a simple application that runs in the background to monitor line states and to report line state changes to a nominated log file.  It's primary purpose is to make sure that the Network Interface associated with the line is set to "down" if the physical line is disconnected, and then set back to "up" when the line is reconnected.  Line disconnection is detected by the absence of a line control signal input, e.g.

The daemon also checks for the presence or absence of clock, but takes no action other than to report the event.

The daemon can be used to monitor both FarSync WAN ports or FarSync OEM ports that use the Network RAW Sockets.  A configuration file identifies the Network Interfaces to be monitored and also the name and location of the log file.  There are two versions of the daemon supplied, one for 32 bits system (farnetd_32) and one for 64 bit systems (farnetd_64).

The following illustrates the scenario where the physical line is disconnected:

  1. the farnetd is started and the daemon starts monitoring the required Network Interfaces
  2. the lines are configured with the ifup hdlcX commands and become active straight away
  3. the daemon recognises the lines as active by processing the input signals
  4. then the cable gets disconnected
  5. the daemon detects the line as down by the absence of input signals and sets the Network Interface down
  6. at some time later, the cable is reconnected
  7. the daemon detects the line as up by the presence of input signals and sets the interface up again

The farnetd.cfg configuration file, must be resident in the same directory as the executable, and defines the configuration of the application in terms of lines to be monitored, the poll rate of the signals/alarms, debounce count and logfile name.

The configuration file parameters are as shown below:

Parameter name Typical value Meaning
DEVICE= hdlc0 The lines to be monitored have assigned names such as hdlc0, hdlc3 etc. These are defined with one or more of these statements
POLLRATE= 5 The rate at which signals are polled is defined in seconds
DEBOUNCE= 5 The debounce count defines the number of consecutive unchanging poll periods for which a signal/alarm state must be steady before it is recognised as a change.
LOGFILE= /var/log/farnetd.log Where the logfile is to be created.  It will contain the configuration information and time-stamped signal change events.
#   Comments in the file may start with the hash character.

The farnetd application will accept the following command line options:

farnetd can be run from the command line, however it may be more useful for the daemon to be run from a startup script. For example, the network daemon could be started in /etc/rc.d/init.d/farsync by adding the following:-

-------------------------------------------------------------------------------
# Start the FarSync T-Series Network Daemon 
cd /etc/farsite/farnetd/
./farnetd
------------------------------------------------------------------------------- 

where /etc/farsite/farnetd/ contains the farnetd executable and the farnetd.cfg
configuration file.

Example Config File Format

#
# FarSite FarSync T-Series Network Daemon Configuration File
#
#Parameter names should start in the first column, have
#no space before or after the '=' and be in uppercase.
#

#
# Log file path and filename
# e.g. LOGFILE=/var/log/farnetd.log
#

LOGFILE=/var/log/farnetd.log

#
# Ports to be monitored
# e.g. DEVICE=sync0
#      DEVICE=sync3
#

DEVICE=hdlc0
#DEVICE=hdlc1
#DEVICE=hdlc2
#DEVICE=hdlcc3

#
# Polling period, the sampling period for status monitoring.
# e.g. POLLRATE=1
# minimum value: 1 (second)
# maximum value:
#

POLLRATE=1

#
# Debounce counter, number of polling periods for which the polled
# status must remain unchanged before being recognised as a change.
# e.g. DEBOUNCE=5
# minimum value: 0 (use 0 to disable this feature)
# maximum value:
#

DEBOUNCE=5

 

Example Log File Content

-------------------------------------------------------
FarSite FarSync T-Series Network Daemon - Version 0.02
-------------------------------------------------------

Started         : Fri Oct 30 10:41:10 2009
Monitoring      : 1 device(s)
Device 0        : hdlc0
Logfile         : /var/log/farnetd.log
Pollrate        : 1 second(s)
Debounce        : 5 times

IP address to ping is []
Fri Oct 30 10:41:26 2009 : Line state change, line hdlc0 is up
Fri Oct 30 10:41:26 2009 : Clock State change, clock on hdlc0 is present
Fri Oct 30 10:41:26 2009 : Clock State change, clock on hdlc0 is missing
Fri Oct 30 10:42:06 2009 : Line state change, line hdlc0 is down

In this example, hdlc0 is looped to hdlc1, but only hdlc0 is being monitored.  The hdlc0 line was brought up first, followed by the hdlc1 line and then the cable between the two ports was disconnected.

Copyright © 2001-2010 FarSite Communications Ltd.