125cf1a30Sjl#!/bin/sh 225cf1a30Sjl# 325cf1a30Sjl# CDDL HEADER START 425cf1a30Sjl# 525cf1a30Sjl# The contents of this file are subject to the terms of the 625cf1a30Sjl# Common Development and Distribution License (the "License"). 725cf1a30Sjl# You may not use this file except in compliance with the License. 825cf1a30Sjl# 925cf1a30Sjl# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 1025cf1a30Sjl# or http://www.opensolaris.org/os/licensing. 1125cf1a30Sjl# See the License for the specific language governing permissions 1225cf1a30Sjl# and limitations under the License. 1325cf1a30Sjl# 1425cf1a30Sjl# When distributing Covered Code, include this CDDL HEADER in each 1525cf1a30Sjl# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 1625cf1a30Sjl# If applicable, add the following below this CDDL HEADER, with the 1725cf1a30Sjl# fields enclosed by brackets "[]" replaced with your own identifying 1825cf1a30Sjl# information: Portions Copyright [yyyy] [name of copyright owner] 1925cf1a30Sjl# 2025cf1a30Sjl# CDDL HEADER END 2125cf1a30Sjl# 2225cf1a30Sjl# 2325cf1a30Sjl# Copyright 2006 Sun Microsystems, Inc. All rights reserved. 2425cf1a30Sjl# Use is subject to license terms. 2525cf1a30Sjl# 2625cf1a30Sjl# ident "%Z%%M% %I% %E% SMI" 2725cf1a30Sjl# 2825cf1a30Sjl 2925cf1a30Sjl# 3025cf1a30Sjl# Start script for the SPARC-Enterprise DSCP service. 3125cf1a30Sjl# 3225cf1a30Sjl 3325cf1a30Sjl. /lib/svc/share/smf_include.sh 3425cf1a30Sjl 3525cf1a30SjlOPL=SUNW,SPARC-Enterprise 3625cf1a30SjlOPL_LIB=/usr/platform/${OPL}/lib 3725cf1a30SjlDM2S_DEVICE=/dev/dm2s0 3825cf1a30SjlPPP_OPTIONS=${OPL_LIB}/dscp.ppp.options 3925cf1a30SjlDSCP_IFNAME=/var/run/dscp.ifname 4025cf1a30SjlPRTDSCP=/usr/platform/${OPL}/sbin/prtdscp 4125cf1a30SjlPLATFORM=`/sbin/uname -i` 4225cf1a30SjlSLEEP=/bin/sleep 4325cf1a30SjlPKILL=/bin/pkill 4425cf1a30Sjl 4525cf1a30SjlLD_LIBRARY_PATH=/lib:${OPL_LIB}; export LD_LIBRARY_PATH 4625cf1a30Sjl 4725cf1a30Sjl# This service can only run on OPL. 48*0b05a701Smcwalterif [ "${PLATFORM}" != "${OPL}" ]; then 4925cf1a30Sjl exit $SMF_EXIT_ERR_CONFIG 5025cf1a30Sjlfi 5125cf1a30Sjl 5225cf1a30Sjlcase "$1" in 5325cf1a30Sjl'start') 5425cf1a30Sjl 5525cf1a30Sjl if [ ! -x /usr/bin/pppd ]; then 5625cf1a30Sjl exit $SMF_EXIT_ERR_CONFIG 5725cf1a30Sjl fi 5825cf1a30Sjl 5925cf1a30Sjl if [ ! -c $DM2S_DEVICE ]; then 6025cf1a30Sjl exit $SMF_EXIT_ERR_CONFIG 6125cf1a30Sjl fi 6225cf1a30Sjl 6325cf1a30Sjl if [ ! -f $PPP_OPTIONS ]; then 6425cf1a30Sjl exit $SMF_EXIT_ERR_CONFIG 6525cf1a30Sjl fi 6625cf1a30Sjl 6725cf1a30Sjl SUCCESS=0 6825cf1a30Sjl for UNIT in 0 1 2 3 4 5 6 7 8 9; do 6925cf1a30Sjl /usr/bin/pppd $DM2S_DEVICE unit $UNIT file $PPP_OPTIONS 7025cf1a30Sjl if [ ! "$?" = "1" ]; then 7125cf1a30Sjl echo "sppp$UNIT" > $DSCP_IFNAME 7225cf1a30Sjl SUCCESS=1 7325cf1a30Sjl break 7425cf1a30Sjl fi 7525cf1a30Sjl done 7625cf1a30Sjl 7725cf1a30Sjl if [ $SUCCESS -ne 1 ]; then 7825cf1a30Sjl exit $SMF_EXIT_ERR_FATAL 7925cf1a30Sjl fi 8025cf1a30Sjl 8125cf1a30Sjl # Wait for the DSCP link to come up, but only for 30 seconds 8225cf1a30Sjl for RETRY in 0 1 2 3 4 5; do 8325cf1a30Sjl ${PRTDSCP} >/dev/null 2>&1 8425cf1a30Sjl if [ $? -eq 0 ]; then 8525cf1a30Sjl exit $SMF_EXIT_OK 8625cf1a30Sjl fi 8725cf1a30Sjl ${SLEEP} 5 8825cf1a30Sjl done 8925cf1a30Sjl 9025cf1a30Sjl # Stop pppd before we return failure 9125cf1a30Sjl ${PKILL} -TERM -f "pppd ${DM2S_DEVICE}" 9225cf1a30Sjl ${SLEEP} 1 9325cf1a30Sjl ${PKILL} -KILL -f "pppd ${DM2S_DEVICE}" 9425cf1a30Sjl rm -f $DSCP_IFNAME 9525cf1a30Sjl exit $SMF_EXIT_ERR_FATAL 9625cf1a30Sjl ;; 9725cf1a30Sjl 9825cf1a30Sjl'stop') 9925cf1a30Sjl # First try SIGTERM and then SIGKILL 10025cf1a30Sjl ${PKILL} -TERM -f "pppd ${DM2S_DEVICE}" 10125cf1a30Sjl ${SLEEP} 1 10225cf1a30Sjl ${PKILL} -KILL -f "pppd ${DM2S_DEVICE}" 10325cf1a30Sjl rm -f $DSCP_IFNAME 10425cf1a30Sjl exit $SMF_EXIT_OK 10525cf1a30Sjl ;; 10625cf1a30Sjlesac 107