summaryrefslogtreecommitdiff
path: root/templates/connect
diff options
context:
space:
mode:
authorAn-Cheng Huang <ancheng@vyatta.com>2009-11-09 11:33:40 -0800
committerAn-Cheng Huang <ancheng@vyatta.com>2009-11-09 11:33:40 -0800
commit5cd2ecb9e7c0da248b698a3dcedc9681fe3bde73 (patch)
tree9c67b94ab91c602fbc95cec1c76b458edae79ed8 /templates/connect
parentd63907c8dd9ed403efd9b3b6a46f21b24e557ba0 (diff)
downloadvyatta-op-5cd2ecb9e7c0da248b698a3dcedc9681fe3bde73.tar.gz
vyatta-op-5cd2ecb9e7c0da248b698a3dcedc9681fe3bde73.zip
move generic interface op commands to vyatta-op
Diffstat (limited to 'templates/connect')
-rw-r--r--templates/connect/interface/node.def2
-rw-r--r--templates/connect/interface/node.tag/node.def28
-rw-r--r--templates/connect/node.def1
3 files changed, 31 insertions, 0 deletions
diff --git a/templates/connect/interface/node.def b/templates/connect/interface/node.def
new file mode 100644
index 0000000..a94a721
--- /dev/null
+++ b/templates/connect/interface/node.def
@@ -0,0 +1,2 @@
+help: Bring up a connection-oriented network interface
+
diff --git a/templates/connect/interface/node.tag/node.def b/templates/connect/interface/node.tag/node.def
new file mode 100644
index 0000000..dd806e3
--- /dev/null
+++ b/templates/connect/interface/node.tag/node.def
@@ -0,0 +1,28 @@
+help: Bring up connection-oriented interface
+
+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: $3"
+ elif [ -d /sys/class/net/$IFNAME ]; then
+ echo "Interface $IFNAME is already connected."
+ elif [ ! -z "`ps -C pppd -f | grep $IFNAME `" ]; then
+ echo "Interface ${IFNAME}: Connection is being established."
+ else
+ echo "Bringing interface $IFNAME up..."
+ echo "`date`: User $USER starting PPP daemon for $IFNAME by connect command" >> $LOGFILE
+ if [ "${IFNAME::3}" = "wan" ]; then
+ # Serial interfaces are started with "pon"
+ (umask 0; sudo /usr/sbin/pon $IFNAME > \
+ /dev/null 2>&1 & )
+ else
+ # PPPOE, PPPOA, WLM interfaces are started directly
+ ( umask 0; sudo /usr/sbin/pppd call $IFNAME > \
+ /tmp/${IFNAME}.log 2>&1 & )
+ fi
+ fi
diff --git a/templates/connect/node.def b/templates/connect/node.def
new file mode 100644
index 0000000..471f21f
--- /dev/null
+++ b/templates/connect/node.def
@@ -0,0 +1 @@
+help: Establish a connection