summaryrefslogtreecommitdiff
path: root/templates/disconnect
diff options
context:
space:
mode:
Diffstat (limited to 'templates/disconnect')
-rw-r--r--templates/disconnect/interface/node.def2
-rw-r--r--templates/disconnect/interface/node.tag/node.def34
-rw-r--r--templates/disconnect/node.def2
3 files changed, 38 insertions, 0 deletions
diff --git a/templates/disconnect/interface/node.def b/templates/disconnect/interface/node.def
new file mode 100644
index 0000000..c7d88e8
--- /dev/null
+++ b/templates/disconnect/interface/node.def
@@ -0,0 +1,2 @@
+help: Take down a connection-oriented network interface
+
diff --git a/templates/disconnect/interface/node.tag/node.def b/templates/disconnect/interface/node.tag/node.def
new file mode 100644
index 0000000..85233ec
--- /dev/null
+++ b/templates/disconnect/interface/node.tag/node.def
@@ -0,0 +1,34 @@
+help: Bring connection-oriented interface down
+
+allowed: local -a array ;
+ array=( /etc/ppp/peers/pppoe* /etc/ppp/peers/pppoa* /etc/ppp/peers/wan* /etc/ppp/peers/wlm* ) ;
+ echo -n ${array[@]##*/}
+
+run:
+ IFNAME=${3}
+ LOGFILE=/var/log/vyatta/ppp_${IFNAME}.log
+ if [ ! -e /etc/ppp/peers/${IFNAME} ]; then
+ echo "Invalid interface: $IFNAME"
+ elif [ -z "`ps -C pppd -f | grep $IFNAME`" ]; then
+ echo "Interface $IFNAME: Connection is already down"
+ else
+ # Serial PPP interfaces are started with "pon", which
+ # lingers around as a watchdog process. Sometimes
+ # multiple "pon" scripts are running. So we need to kill
+ # all pon scripts relating to this interface before
+ # before killing the pppd process
+ if [ "${IFNAME::3}" = "wan" ]; then
+ PON_PIDS=` ps -C pon -f | grep $IFNAME | awk '{print $2}'`
+ if [ -n "$PON_PIDS" ]; then
+ echo "killing pon pids: $PON_PIDS"
+ for PID in $PON_PIDS ; do
+ kill -HUP $PID
+ done
+ fi
+ fi
+
+ echo "Bringing interface $IFNAME down..."
+ echo "`date`: User $USER stopping PPP daemon for $IFNAME by disconnect command" >> $LOGFILE
+ sudo /sbin/poff $IFNAME
+ fi
+
diff --git a/templates/disconnect/node.def b/templates/disconnect/node.def
new file mode 100644
index 0000000..fce9a97
--- /dev/null
+++ b/templates/disconnect/node.def
@@ -0,0 +1,2 @@
+help: Take down a connection
+