#!/bin/ksh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # MY_PUNCHIN_ADDR=XXX1.XXX2.XXX3.XXX4 IFCONFIG=/sbin/ifconfig AWK=/usr/bin/nawk ZENITY=/usr/bin/zenity $IFCONFIG ip.tun0 > /dev/null 2>&1 if [ $? -eq 0 ]; then # We have a tunnel. addr=`$IFCONFIG ip.tun0 | grep -- '-->' | $AWK '{print $2}'` else numaddrs=`$IFCONFIG -a | grep "inet " | grep -v 0.0.0.0 | \ grep -v 127.0.0.1 | wc -l` addr=`$IFCONFIG -a | grep "inet " | grep -v 0.0.0.0 | \ grep -v 127.0.0.1 | $AWK '{print $2}'` if [ $numaddrs -gt 1 ]; then $ZENITY --error --text="$addr" echo unknown exit 1 fi fi if [ -z "$addr" ]; then echo none exit 1 fi NET1=`echo $addr | $AWK -F. '{print $1}'` NET2=`echo $addr | $AWK -F. '{print $2}'` NET3=`echo $addr | $AWK -F. '{print $3}'` NET4=`echo $addr | $AWK -F. '{print $4}'` if [ $addr = $MY_PUNCHIN_ADDR ]; then echo swan elif [ $NET1 = 129 ]; then if [ $NET2 -ge 145 -a $NET2 -le 159 ]; then echo swan else echo "129.unknown" fi elif [ $NET1 = XXX1 -a $NET2 = XXX2 -a $NET3 = XXX3 ]; then if [ $NET4 -ge XXXA -a $NET4 -le XXXB ]; then echo "home" else echo "XXX1.XXX2.XXX3.unknown" fi elif [ $NET1 = 10 -a $NET2 = 21 -a $NET3 = 12 ]; then echo "punchin-wlan" else echo unknown fi exit 0