#!/bin/sh # # $FreeBSD$ # err() { echo "$*" >&2 } usage() { err "Usage: `basename $0` atmindex loc_ip udp_port rem_ip udp_port [pref_iface]" err " or: `basename $0` flush" exit $1 } args=`getopt ed $*` if [ $? != 0 ] ; then usage 2 fi set -- $args debug_enable=0 for i do case "$i" in -e) debug_enable=1 shift;; -d) debug_enable=-1 shift;; --) shift ; break;; esac done if [ $# -lt 1 ] ; then err "Missing arguments" usage 1 fi # # Handle debug flags # case ${debug_enable} in 1) # # Enable all the HARP debugging features # sysctl -w net.harp.atm.atm_debug=1 sysctl -w net.harp.atm.atm_dev_print=1 sysctl -w net.harp.atm.atm_print_data=1 sysctl -w net.harp.ip.ipatm_print=1 sysctl -w net.harp.spans.spanscls_print=1 sysctl -w net.harp.uni.uniarp_print=1 sysctl -w net.harp.uni.unisig_print_msg=2 ;; -1) # # Disable all the HARP debugging features # sysctl -w net.harp.atm.atm_debug=0 sysctl -w net.harp.atm.atm_dev_print=0 sysctl -w net.harp.atm.atm_print_data=0 sysctl -w net.harp.ip.ipatm_print=0 sysctl -w net.harp.spans.spanscls_print=0 sysctl -w net.harp.uni.uniarp_print=0 sysctl -w net.harp.uni.unisig_print_msg=0 ;; esac if [ "${1}" = "flush" ] ; then # # Remove all atmpif nodes # for i in `ngctl list | grep atmpif | awk '{print $6}'` ; do ngctl shutdown [$i]: done exit 0 fi ID=${1} if [ $# -lt 5 -o $# -gt 6 ] ; then err "wrong number of arguments" usage 1 fi LOC_IP=${2} LOC_UDP_PORT=${3} REM_IP=${4} REM_UDP_PORT=${5} PREF_IFACE=${6} if [ "${LOC_IP}" = "" -o "${LOC_UDP_PORT}" = "" -o \ "${REM_IP}" = "" -o "${REM_UDP_PORT}" = "" ] ; then err "bad argument" usage 1 fi # # Default interface prefix: atmX # if [ "${PREF_IFACE}" = "" ] ; then PREF_IFACE="atm" fi # Create the ATM PIF (Physical Interface) vatmpifXX # ngctl -f - <