17c478bd9Sstevel@tonic-gate#!/sbin/sh 27c478bd9Sstevel@tonic-gate# 37c478bd9Sstevel@tonic-gate# CDDL HEADER START 47c478bd9Sstevel@tonic-gate# 57c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the 64d53c7adSDan Price# Common Development and Distribution License (the "License"). 74d53c7adSDan Price# You may not use this file except in compliance with the License. 87c478bd9Sstevel@tonic-gate# 97c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate# and limitations under the License. 137c478bd9Sstevel@tonic-gate# 147c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate# 207c478bd9Sstevel@tonic-gate# CDDL HEADER END 217c478bd9Sstevel@tonic-gate# 227c478bd9Sstevel@tonic-gate# 234d53c7adSDan Price# Copyright 2009 Sun Microsystems, Inc. All rights reserved. 244d53c7adSDan Price# Use is subject to license terms. 257c478bd9Sstevel@tonic-gate# 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gatePATH=/sbin:/usr/bin:/usr/sbin; export PATH 287c478bd9Sstevel@tonic-gatePPPDIR=/etc/ppp; export PPPDIR 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gatecase "$1" in 317c478bd9Sstevel@tonic-gate'start') 327c478bd9Sstevel@tonic-gate if [ ! -x /usr/bin/pppd -o ! -c /dev/sppp ]; then 337c478bd9Sstevel@tonic-gate echo "$0: Solaris PPP has not been correctly installed on" 347c478bd9Sstevel@tonic-gate echo "$0: this system. Required files are missing." 357c478bd9Sstevel@tonic-gate exit 1 367c478bd9Sstevel@tonic-gate fi 377c478bd9Sstevel@tonic-gate if [ -f $PPPDIR/ifconfig ]; then 387c478bd9Sstevel@tonic-gate . $PPPDIR/ifconfig 397c478bd9Sstevel@tonic-gate fi 407c478bd9Sstevel@tonic-gate if [ -f $PPPDIR/demand ]; then 417c478bd9Sstevel@tonic-gate . $PPPDIR/demand 427c478bd9Sstevel@tonic-gate fi 437c478bd9Sstevel@tonic-gate if [ -f $PPPDIR/pppoe.if ] && [ -x /usr/sbin/sppptun ]; then 447c478bd9Sstevel@tonic-gate sed -e 's/^#.*//;s/\([^\\]\)#.*/\1/;s/[ ]*$//;s/^[ ]*//' \ 457c478bd9Sstevel@tonic-gate $PPPDIR/pppoe.if | \ 46*f53eecf5SJames Carlson while read intf saps sapd; do 477c478bd9Sstevel@tonic-gate if [ "$intf" ]; then 48*f53eecf5SJames Carlson [ -z "$saps" ] || saps="-s $saps" 49*f53eecf5SJames Carlson /usr/sbin/sppptun plumb $saps pppoe $intf 50*f53eecf5SJames Carlson [ -z "$sapd" ] || sapd="-s $sapd" 51*f53eecf5SJames Carlson /usr/sbin/sppptun plumb $sapd pppoed $intf 527c478bd9Sstevel@tonic-gate fi 537c478bd9Sstevel@tonic-gate done 547c478bd9Sstevel@tonic-gate fi 557c478bd9Sstevel@tonic-gate if [ -f $PPPDIR/pppoe ] && [ -x /usr/lib/inet/pppoed ]; then 567c478bd9Sstevel@tonic-gate /usr/lib/inet/pppoed >/dev/null 577c478bd9Sstevel@tonic-gate fi 587c478bd9Sstevel@tonic-gate ;; 597c478bd9Sstevel@tonic-gate 607c478bd9Sstevel@tonic-gate'stop') 614d53c7adSDan Price /usr/bin/pkill -z `/sbin/zonename` -x pppd && sleep 1 624d53c7adSDan Price /usr/bin/pkill -z `/sbin/zonename` -x pppoed 637c478bd9Sstevel@tonic-gate 647c478bd9Sstevel@tonic-gate # Use ifconfig to make the interfaces down just in case 657c478bd9Sstevel@tonic-gate if [ -f $PPPDIR/ifconfig ]; then 667c478bd9Sstevel@tonic-gate nawk '/ifconfig[ ]*sppp/ { \ 677c478bd9Sstevel@tonic-gate system("ifconfig " $2 " down"); \ 687c478bd9Sstevel@tonic-gate system("ifconfig " $2 " unplumb"); \ 697c478bd9Sstevel@tonic-gate next; \ 707c478bd9Sstevel@tonic-gate } \ 717c478bd9Sstevel@tonic-gate /ifconfig/ { \ 727c478bd9Sstevel@tonic-gate $3 = "removeif"; \ 737c478bd9Sstevel@tonic-gate NF = 4; \ 747c478bd9Sstevel@tonic-gate system($0); \ 757c478bd9Sstevel@tonic-gate }' < $PPPDIR/ifconfig 767c478bd9Sstevel@tonic-gate fi 777c478bd9Sstevel@tonic-gate 787c478bd9Sstevel@tonic-gate if [ -f $PPPDIR/pppoe.if ] && [ -x /usr/sbin/sppptun ]; then 797c478bd9Sstevel@tonic-gate sed -e 's/^#.*//;s/\([^\\]\)#.*/\1/;s/[ ]*$//;s/^[ ]*//' \ 807c478bd9Sstevel@tonic-gate $PPPDIR/pppoe.if | \ 81*f53eecf5SJames Carlson while read intf rest; do 827c478bd9Sstevel@tonic-gate if [ "$intf" ]; then 837c478bd9Sstevel@tonic-gate /usr/sbin/sppptun unplumb ${intf}:pppoe 847c478bd9Sstevel@tonic-gate /usr/sbin/sppptun unplumb ${intf}:pppoed 857c478bd9Sstevel@tonic-gate fi 867c478bd9Sstevel@tonic-gate done 877c478bd9Sstevel@tonic-gate fi 887c478bd9Sstevel@tonic-gate ;; 897c478bd9Sstevel@tonic-gate 907c478bd9Sstevel@tonic-gate*) 917c478bd9Sstevel@tonic-gate echo "Usage: $0 { start | stop }" 927c478bd9Sstevel@tonic-gate exit 1 937c478bd9Sstevel@tonic-gate ;; 947c478bd9Sstevel@tonic-gateesac 957c478bd9Sstevel@tonic-gateexit 0 96