summaryrefslogtreecommitdiff
path: root/templates/system/console/network/node.def
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2012-04-04 15:38:13 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2012-04-04 15:38:13 -0700
commitd1fc3e13893a938ad5d62ef68c30ec3003d7b54f (patch)
tree05405292273f6f92ec5ed50ee9938035db346566 /templates/system/console/network/node.def
parent2be9c02490c3bf776b31c90d0dd8cb4d8b3494cd (diff)
downloadvyatta-cfg-system-d1fc3e13893a938ad5d62ef68c30ec3003d7b54f.tar.gz
vyatta-cfg-system-d1fc3e13893a938ad5d62ef68c30ec3003d7b54f.zip
Add network console support
Bug 6883 This enhancement adds ability to configure one or more network consoles. A network console sends a copy of all console messages over UDP. Each target can be configured with local, remote and interface. The only required parameter is the interface name. The local and remote ports both have default values, and by default traffic is sent as broadcast. For more information see kernel: Documentation/networking/netconsole.txt Configuration example: device ttyS0 { speed 9600 } network netcon0 { interface eth0 remote { address 192.168.91.1 } }
Diffstat (limited to 'templates/system/console/network/node.def')
-rw-r--r--templates/system/console/network/node.def33
1 files changed, 33 insertions, 0 deletions
diff --git a/templates/system/console/network/node.def b/templates/system/console/network/node.def
new file mode 100644
index 00000000..d8184461
--- /dev/null
+++ b/templates/system/console/network/node.def
@@ -0,0 +1,33 @@
+tag:
+type: txt
+help: Network based console logging
+priority: 400 # After network interface
+val_help: <netconXX>; Network console device name
+
+syntax:expression: pattern $VAR(@) "^netcon[0-9]+$" \
+ ; "network console $VAR(@): not a valid name"
+
+begin: # Make configfs if not present
+ if [ ! -d /dev/config ] ; then
+ sudo mkdir /dev/config
+ sudo mount -t configfs none /dev/config
+ fi
+ # Add netconsole module if not already present
+ [ -d /dev/config/netconsole ] || sudo modprobe netconsole
+ # create network console object
+ NETCONS=/dev/config/netconsole/$VAR(@)
+ [ -d $NETCONS ] || sudo mkdir $NETCONS
+ # leave disabled until end of transaction
+ if [ $(cat $NETCONS/enabled) -ne 0 ]; then
+ sudo sh -c "echo 0 > $NETCONS/enabled"
+ fi
+
+commit:expression: $VAR(interface) != "" ; "interface must be specified"
+
+delete: sudo rmdir /dev/config/netconsole/$VAR(@)
+
+end: NETCONS=/dev/config/netconsole/$VAR(@)
+ # enable console if not deleted
+ if [ -d $NETCONS ]; then
+ sudo sh -c "echo 1 > $NETCONS/enabled"
+ fi