10Sstevel@tonic-gate#!/sbin/sh 20Sstevel@tonic-gate# 30Sstevel@tonic-gate# CDDL HEADER START 40Sstevel@tonic-gate# 50Sstevel@tonic-gate# The contents of this file are subject to the terms of the 68944Sdp@eng.sun.com# Common Development and Distribution License (the "License"). 78944Sdp@eng.sun.com# You may not use this file except in compliance with the License. 80Sstevel@tonic-gate# 90Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 100Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing. 110Sstevel@tonic-gate# See the License for the specific language governing permissions 120Sstevel@tonic-gate# and limitations under the License. 130Sstevel@tonic-gate# 140Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each 150Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 160Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the 170Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying 180Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner] 190Sstevel@tonic-gate# 200Sstevel@tonic-gate# CDDL HEADER END 210Sstevel@tonic-gate# 220Sstevel@tonic-gate# 238944Sdp@eng.sun.com# Copyright 2009 Sun Microsystems, Inc. All rights reserved. 248944Sdp@eng.sun.com# Use is subject to license terms. 250Sstevel@tonic-gate# 260Sstevel@tonic-gate 270Sstevel@tonic-gatePATH=/sbin:/usr/bin:/usr/sbin; export PATH 280Sstevel@tonic-gatePPPDIR=/etc/ppp; export PPPDIR 290Sstevel@tonic-gate 300Sstevel@tonic-gatecase "$1" in 310Sstevel@tonic-gate'start') 320Sstevel@tonic-gate if [ ! -x /usr/bin/pppd -o ! -c /dev/sppp ]; then 330Sstevel@tonic-gate echo "$0: Solaris PPP has not been correctly installed on" 340Sstevel@tonic-gate echo "$0: this system. Required files are missing." 350Sstevel@tonic-gate exit 1 360Sstevel@tonic-gate fi 370Sstevel@tonic-gate if [ -f $PPPDIR/ifconfig ]; then 380Sstevel@tonic-gate . $PPPDIR/ifconfig 390Sstevel@tonic-gate fi 400Sstevel@tonic-gate if [ -f $PPPDIR/demand ]; then 410Sstevel@tonic-gate . $PPPDIR/demand 420Sstevel@tonic-gate fi 430Sstevel@tonic-gate if [ -f $PPPDIR/pppoe.if ] && [ -x /usr/sbin/sppptun ]; then 440Sstevel@tonic-gate sed -e 's/^#.*//;s/\([^\\]\)#.*/\1/;s/[ ]*$//;s/^[ ]*//' \ 450Sstevel@tonic-gate $PPPDIR/pppoe.if | \ 46*9751Sjames.d.carlson@sun.com while read intf saps sapd; do 470Sstevel@tonic-gate if [ "$intf" ]; then 48*9751Sjames.d.carlson@sun.com [ -z "$saps" ] || saps="-s $saps" 49*9751Sjames.d.carlson@sun.com /usr/sbin/sppptun plumb $saps pppoe $intf 50*9751Sjames.d.carlson@sun.com [ -z "$sapd" ] || sapd="-s $sapd" 51*9751Sjames.d.carlson@sun.com /usr/sbin/sppptun plumb $sapd pppoed $intf 520Sstevel@tonic-gate fi 530Sstevel@tonic-gate done 540Sstevel@tonic-gate fi 550Sstevel@tonic-gate if [ -f $PPPDIR/pppoe ] && [ -x /usr/lib/inet/pppoed ]; then 560Sstevel@tonic-gate /usr/lib/inet/pppoed >/dev/null 570Sstevel@tonic-gate fi 580Sstevel@tonic-gate ;; 590Sstevel@tonic-gate 600Sstevel@tonic-gate'stop') 618944Sdp@eng.sun.com /usr/bin/pkill -z `/sbin/zonename` -x pppd && sleep 1 628944Sdp@eng.sun.com /usr/bin/pkill -z `/sbin/zonename` -x pppoed 630Sstevel@tonic-gate 640Sstevel@tonic-gate # Use ifconfig to make the interfaces down just in case 650Sstevel@tonic-gate if [ -f $PPPDIR/ifconfig ]; then 660Sstevel@tonic-gate nawk '/ifconfig[ ]*sppp/ { \ 670Sstevel@tonic-gate system("ifconfig " $2 " down"); \ 680Sstevel@tonic-gate system("ifconfig " $2 " unplumb"); \ 690Sstevel@tonic-gate next; \ 700Sstevel@tonic-gate } \ 710Sstevel@tonic-gate /ifconfig/ { \ 720Sstevel@tonic-gate $3 = "removeif"; \ 730Sstevel@tonic-gate NF = 4; \ 740Sstevel@tonic-gate system($0); \ 750Sstevel@tonic-gate }' < $PPPDIR/ifconfig 760Sstevel@tonic-gate fi 770Sstevel@tonic-gate 780Sstevel@tonic-gate if [ -f $PPPDIR/pppoe.if ] && [ -x /usr/sbin/sppptun ]; then 790Sstevel@tonic-gate sed -e 's/^#.*//;s/\([^\\]\)#.*/\1/;s/[ ]*$//;s/^[ ]*//' \ 800Sstevel@tonic-gate $PPPDIR/pppoe.if | \ 81*9751Sjames.d.carlson@sun.com while read intf rest; do 820Sstevel@tonic-gate if [ "$intf" ]; then 830Sstevel@tonic-gate /usr/sbin/sppptun unplumb ${intf}:pppoe 840Sstevel@tonic-gate /usr/sbin/sppptun unplumb ${intf}:pppoed 850Sstevel@tonic-gate fi 860Sstevel@tonic-gate done 870Sstevel@tonic-gate fi 880Sstevel@tonic-gate ;; 890Sstevel@tonic-gate 900Sstevel@tonic-gate*) 910Sstevel@tonic-gate echo "Usage: $0 { start | stop }" 920Sstevel@tonic-gate exit 1 930Sstevel@tonic-gate ;; 940Sstevel@tonic-gateesac 950Sstevel@tonic-gateexit 0 96