aboutsummaryrefslogtreecommitdiffstats
path: root/config/quagga_ospfd/quaggactl
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2012-03-08 16:30:06 -0500
committerjim-p <jimp@pfsense.org>2012-03-08 16:30:06 -0500
commit8488b5a6e0f662a8e4405fd5f1209792440a400e (patch)
treee9d474b6f1191ebd4e4d936d08281615358b026e /config/quagga_ospfd/quaggactl
parent7ffe81a70fed8a267bf1a478cc4dcde228ccbaa0 (diff)
downloadpfsense-packages-8488b5a6e0f662a8e4405fd5f1209792440a400e.tar.gz
pfsense-packages-8488b5a6e0f662a8e4405fd5f1209792440a400e.tar.bz2
pfsense-packages-8488b5a6e0f662a8e4405fd5f1209792440a400e.zip
First attempt at a Quagga-OSPF package to make OpenOSPFd obsolete.
If anyone wants to build on this to support all of quagga's routing protocols, have at it.
Diffstat (limited to 'config/quagga_ospfd/quaggactl')
-rw-r--r--config/quagga_ospfd/quaggactl75
1 files changed, 75 insertions, 0 deletions
diff --git a/config/quagga_ospfd/quaggactl b/config/quagga_ospfd/quaggactl
new file mode 100644
index 00000000..198a8411
--- /dev/null
+++ b/config/quagga_ospfd/quaggactl
@@ -0,0 +1,75 @@
+#!/bin/sh
+RC_SCRIPT=/usr/local/etc/rc.d/quagga.sh
+
+ZEBRA_CONFIG=/usr/local/etc/quagga/zebra.conf
+ZEBRA_PORT=2601
+ZEBRA_PASSWORD=`/usr/bin/grep '^password ' ${ZEBRA_CONFIG} | /usr/bin/awk '{print $2};'`
+
+OSPF_CONFIG=/usr/local/etc/quagga/ospfd.conf
+OSPF_PORT=2604
+OSPF_PASSWORD=`/usr/bin/grep '^password ' ${OSPF_CONFIG} | /usr/bin/awk '{print $2};'`
+
+daemon_command() {
+ COMMANDS=${2}
+ COMMANDS=${COMMANDS}`echo -e "\n${3}\n"`
+ COMMANDS=${COMMANDS}`echo -e "\nexit\n"`
+ echo "$COMMANDS" | /usr/bin/nc localhost ${1} | /usr/bin/tail -n +10 | sed '$d'
+}
+
+case $1 in
+stop)
+ $RC_SCRIPT stop
+ ;;
+start)
+ $RC_SCRIPT start
+ ;;
+restart)
+ $RC_SCRIPT restart
+ ;;
+zebra)
+ case $2 in
+ cpu*)
+ daemon_command ${ZEBRA_PORT} ${ZEBRA_PASSWORD} "show thread cpu"
+ ;;
+ mem*)
+ shift; shift;
+ daemon_command ${ZEBRA_PORT} ${ZEBRA_PASSWORD} "show memory $*"
+ ;;
+ int*)
+ daemon_command ${ZEBRA_PORT} ${ZEBRA_PASSWORD} "show interface $3"
+ ;;
+ rou*)
+ daemon_command ${ZEBRA_PORT} ${ZEBRA_PASSWORD} "show ip route"
+ ;;
+ esac ;;
+ospf)
+ case $2 in
+ cpu*)
+ daemon_command ${OSPF_PORT} ${OSPF_PASSWORD} "show thread cpu"
+ ;;
+ mem*)
+ shift; shift;
+ daemon_command ${OSPF_PORT} ${OSPF_PASSWORD} "show memory $*"
+ ;;
+ gen*)
+ daemon_command ${OSPF_PORT} ${OSPF_PASSWORD} "show ip ospf"
+ ;;
+ nei*)
+ shift; shift;
+ daemon_command ${OSPF_PORT} ${OSPF_PASSWORD} "show ip ospf neighbor $*"
+ ;;
+ dat*)
+ shift; shift;
+ daemon_command ${OSPF_PORT} ${OSPF_PASSWORD} "show ip ospf database $*"
+ ;;
+ int*)
+ daemon_command ${OSPF_PORT} ${OSPF_PASSWORD} "show ip ospf interface $3"
+ ;;
+ bor*)
+ daemon_command ${OSPF_PORT} ${OSPF_PASSWORD} "show ip ospf border-routers"
+ ;;
+ rou*)
+ daemon_command ${OSPF_PORT} ${OSPF_PASSWORD} "show ip ospf route"
+ ;;
+ esac ;;
+esac