Tracing link failure and recovery.


Cnet provides an event that tracks link failure and recovery.  It might help you to determine if your program is working correctly if you include these events in your program's debug output.


To help you, I've provided an EV_LINKSTATE event handler that will write every link state change that occurs to STDERR.  The information that is written includes:


  1. Node name whose link has changed state
  2. Link number that has changed state
  3. Status of the link as a result of the state change (UP/DOWN)
  4. Time in seconds since reboot



How to use the handler.


The handler is provided in two source files:





In the program that contains your rebooot_node() function, include the header file tracelinkevent.h:


#include "tracelinkevent.h"


In your reboot_node() function, add the following line of code:





In your topology file, add the file name tracelinkevent.c to your compile statement.  Remember that the names of files in the statement are separated by spaces ONLY - no commas!.


Make sure that tracelinkevent.h and tracelinkevent.c are in the same directory as your source files.


You may modify the source in tracelinkevent.c if you wish to change the format of output, or to change the destination to STDOUT, but you may not alter the logic in this method in any way that will provide your program with any information derived from the EV_LINKSTATE event.