summaryrefslogtreecommitdiff
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
parent2be9c02490c3bf776b31c90d0dd8cb4d8b3494cd (diff)
downloadvyatta-cfg-quagga-d1fc3e13893a938ad5d62ef68c30ec3003d7b54f.tar.gz
vyatta-cfg-quagga-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 } }
-rw-r--r--templates/system/console/network/node.def33
-rw-r--r--templates/system/console/network/node.tag/interface/node.def7
-rw-r--r--templates/system/console/network/node.tag/local/address/node.def10
-rw-r--r--templates/system/console/network/node.tag/local/node.def1
-rw-r--r--templates/system/console/network/node.tag/local/port/node.def10
-rw-r--r--templates/system/console/network/node.tag/remote/address/node.def6
-rw-r--r--templates/system/console/network/node.tag/remote/mac/node.def7
-rw-r--r--templates/system/console/network/node.tag/remote/node.def1
-rw-r--r--templates/system/console/network/node.tag/remote/port/node.def10
9 files changed, 85 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
diff --git a/templates/system/console/network/node.tag/interface/node.def b/templates/system/console/network/node.tag/interface/node.def
new file mode 100644
index 00000000..4153ad36
--- /dev/null
+++ b/templates/system/console/network/node.tag/interface/node.def
@@ -0,0 +1,7 @@
+type: txt
+help: Ethernet interface name [REQUIRED]
+allowed: ${vyatta_sbindir}/vyatta-interfaces.pl --show=ethernet
+val_help: Interface for network console
+
+update: NETCONS=/dev/config/netconsole/$VAR(../@)
+ sudo sh -c "echo $VAR(@) > $NETCONS/dev_name"
diff --git a/templates/system/console/network/node.tag/local/address/node.def b/templates/system/console/network/node.tag/local/address/node.def
new file mode 100644
index 00000000..b14c7f6c
--- /dev/null
+++ b/templates/system/console/network/node.tag/local/address/node.def
@@ -0,0 +1,10 @@
+type: ipv4
+help: Local IP address for this console
+val_help: ipv4; Local IPv4 address for this tunnel
+
+syntax:expression: exec \
+ "/opt/vyatta/sbin/local_ip $VAR(@) || \
+ echo Warning! IP address $VAR(@) doesn\\'t exist on this system"
+
+update: NETCONS=/dev/config/netconsole/$VAR(../../@)
+ sudo sh -c "echo $VAR(@) > $NETCONS/local_ip"
diff --git a/templates/system/console/network/node.tag/local/node.def b/templates/system/console/network/node.tag/local/node.def
new file mode 100644
index 00000000..ad89cb49
--- /dev/null
+++ b/templates/system/console/network/node.tag/local/node.def
@@ -0,0 +1 @@
+help: Local parameters for network console
diff --git a/templates/system/console/network/node.tag/local/port/node.def b/templates/system/console/network/node.tag/local/port/node.def
new file mode 100644
index 00000000..14783149
--- /dev/null
+++ b/templates/system/console/network/node.tag/local/port/node.def
@@ -0,0 +1,10 @@
+type: u32
+default: 6665
+help: Local UDP port for network console
+val_help: u32:1-65535; Numeric IP port
+
+syntax:expression: $VAR(@) > 0 && $VAR(@) <= 65535 ; \
+ "Port number must be in range 1 to 65535"
+
+update: NETCONS=/dev/config/netconsole/$VAR(../../@)
+ sudo sh -c "echo $VAR(@) > $NETCONS/local_port"
diff --git a/templates/system/console/network/node.tag/remote/address/node.def b/templates/system/console/network/node.tag/remote/address/node.def
new file mode 100644
index 00000000..97ac6ee1
--- /dev/null
+++ b/templates/system/console/network/node.tag/remote/address/node.def
@@ -0,0 +1,6 @@
+type: ipv4
+help: Remote IP address for this console
+val_help: ipv4; Remote IPv4 address for this tunnel
+
+update: NETCONS=/dev/config/netconsole/$VAR(../../@)
+ sudo sh -c "echo $VAR(@) > $NETCONS/remote_ip"
diff --git a/templates/system/console/network/node.tag/remote/mac/node.def b/templates/system/console/network/node.tag/remote/mac/node.def
new file mode 100644
index 00000000..e59081d7
--- /dev/null
+++ b/templates/system/console/network/node.tag/remote/mac/node.def
@@ -0,0 +1,7 @@
+type: macaddr
+help: Remote Media Access Control (MAC) address
+syntax:expression: exec "\
+ /opt/vyatta/sbin/vyatta-interfaces.pl --dev $VAR(../@) --valid-mac $VAR(@)"
+
+update: NETCONS=/dev/config/netconsole/$VAR(../../@)
+ sudo sh -c "echo $VAR(@) > $NETCONS/remote_mac"
diff --git a/templates/system/console/network/node.tag/remote/node.def b/templates/system/console/network/node.tag/remote/node.def
new file mode 100644
index 00000000..869dd80e
--- /dev/null
+++ b/templates/system/console/network/node.tag/remote/node.def
@@ -0,0 +1 @@
+help: Remote parameters for network console
diff --git a/templates/system/console/network/node.tag/remote/port/node.def b/templates/system/console/network/node.tag/remote/port/node.def
new file mode 100644
index 00000000..d193e20a
--- /dev/null
+++ b/templates/system/console/network/node.tag/remote/port/node.def
@@ -0,0 +1,10 @@
+type: u32
+default: 6666
+help: Remote UDP port for network console
+val_help: u32:1-65535; Numeric IP port
+
+syntax:expression: $VAR(@) > 0 && $VAR(@) <= 65535 ; \
+ "Port number must be in range 1 to 65535"
+
+update: NETCONS=/dev/config/netconsole/$VAR(../../@)
+ sudo sh -c "echo $VAR(@) > $NETCONS/remote_port"