get_desc() { cat <&1 | tee log exit #!/bin/sh # . init-install-split -i "-vm 644" -- \ # configuration for install-split hash ln||exit; DIALD_DEFAULTS="/etc/diald/diald.defaults"; do_add() { #and add these lines to /etc/diald/diald.defaults cat <<-DEFAULTS >>"$DIALD_DEFAULTS" priority -10 ip-goingdown /etc/ppp/ip-goingdown # stay up in 1 minute intervals ( allow 30 seconds to hangup ) impulse 30,30 DEFAULTS } pointer() { $RBR "$DIALD_DEFAULTS"; $NXT do_add; } ERN=pointer; MD5=xx10;MWC=390; #!/bin/sh # /etc/ppp ip-goingdown -ci "-vD" -s "ip-up ip-down" -- \ # ip-goingdown -- This script handles ip-(up|goingdown|down) for ppp|diald # Copyright (C) 2003 by Richard Hawes # This is free software; see the GNU General Public License version 2 # or later for copying conditions. There is NO warranty. # $Revision: 1.18 $ # latest version: www.dma.org/~rhawes/programs/ip-goingdown # check /tmp/ip-goingdown.errors for fatal errors # USAGE: make symbolic links to this program # in /etc/ppp/ for ip-up ip-down # # ip-goingdown can be called from diald or a script such as poff # the first parameter has to be the interface name # NAME SPACE # unexported variables begin with underscore or single letter prefix # functions and variables in sourced files should begin with another prefix # to avoid conflicts with future versions exec 3<>/dev/null; p_init() { SCRIPTNAME="$1"; VARNAME="$2"; eval export PARAM_$2=\"$3\"; # source ip-conf _if_test -f . "$_ETC/ip-conf"||:; TIME_STAMP="$TMPDIR/${IFNAME}.goingdown"; PPP_EXPORTS="$TMPDIR/${IFNAME}.exports"; hash $_CMD_LIST||{ hash $_CMD_LIST&>/tmp/ip-goingdown.errors;}||exit; } p_log() { logger $_LOG_OPT -t "$SCRIPTNAME[$$]";} p_param() { export PPP_IPPARAM="$6" PPP_TTYNAME=`basename "$DEVICE"`; #the other parameters are in the environment # $1 == IFNAME # $2 == DEVICE # $3 == SPEED # $4 == IPLOCAL # $5 == IPREMOTE # but because scripts use these variables . . . export PPP_IFACE="$1" PPP_TTY="$2" PPP_SPEED="$3" export PPP_LOCAL="$4" PPP_REMOTE="$5" } r_pts() { export SCRIPTNAME VARNAME; eval "$1"; eval "$2"; _if_source "$3"||:; _if_source "${3}.${PPP_TTYNAME}"||:; _if_test -d run-parts "${4}.${PPP_TTYNAME}"|| _if_test -d run-parts "${4}" _if_source "$5"||:; _if_source "${5}.${PPP_TTYNAME}"||:; eval "$6"; eval "$7"; } r_parts() { eval _if_unempty renice \"\$_NICE_$1_${PPP_TTYNAME}\" $$|| eval _if_unempty renice \"\$_NICE_$1\" $$; eval r_pts \"\$E_PRE$1\" \"\$E_PRE$1_${PPP_TTYNAME}\" \"\$S_PRE$1\" \ \"\$D_$1\" \"\$S_POST$1\" \"\$E_POST$1\" \"\$E_POST$1_${PPP_TTYNAME}\" } r_pts_goingdown() { [ -f "$TIME_STAMP" ]&&[ "$PPP_EXPORTS" -ot "$TIME_STAMP" ]|| { touch "$TIME_STAMP"; r_parts GOINGDOWN; } } r_pts_up() { _if_test -f "mv -vfb" "$TMPDIR" "${TMPDIR}.orig.$$"||:; _if_test '! -d' "mkdir -vp" "$TMPDIR"||:; export IP_UP_PID=$$; # save exports for goingdown export -p >"$PPP_EXPORTS"; # give kernel time to set up routes eval _if_unempty sleep \"\$_DELAY_${PPP_TTYNAME}\"|| eval _if_unempty sleep \"\$_DELAY\"; r_parts UP; } # functions that could be used in ip-conf _if_test() { [ $1 "$3" ]&&{ shift; eval "$@";};} _if_source() { [ -f "$1" ]&&. $1;} _if_unempty() { [ "$2" ]&&"$@";} _ETC=/etc/ppp; # variables that could be changed in ip-conf _CMD_LIST="echo grep kill logger ls renice run-parts sleep touch"; _DELAY=; _LOG_OPT="-p user.debug"; _NICE_GOINGDOWN=; _NICE_DOWN=; _NICE_UP=; D_DOWN="$_ETC/ip-down.d"; D_GOINGDOWN="$_ETC/ip-goingdown.d"; D_UP="$_ETC/ip-up.d"; E_PREDOWN=":"; E_PREGOINGDOWN=":"; E_PREUP=":"; E_POSTDOWN=":"; E_POSTGOINGDOWN=":"; E_POSTUP=":"; S_PREDOWN="$_ETC/ip-predown"; S_PREGOINGDOWN="$_ETC/ip-pregoingdown"; S_PREUP="$_ETC/ip-preup"; S_POSTDOWN="$_ETC/ip-postdown"; S_POSTGOINGDOWN="$_ETC/ip-postgoingdown"; S_POSTUP="$_ETC/ip-postup"; PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin; TMPDIR=/var/tmp/ppp; export PATH TMPDIR; #base names of symbolic links to this program P_UP="ip-up"; P_DOWN="ip-down"; P_GOINGDOWN="ip-goingdown"; case "$0" in *"$P_UP") p_param "$@"; p_init "$P_UP" IP_UP "$*"; r_pts_up 2>&1 | p_log;; *"$P_GOINGDOWN") IFNAME="$1"; p_init "$P_GOINGDOWN" IP_GOINGDOWN "$*"; { . "$PPP_EXPORTS"; # send ip-up HUP if it is still running kill -0 $IP_UP_PID 2>&3 && kill -HUP $IP_UP_PID; r_pts_goingdown; } 2>&1 | p_log;; *"$P_DOWN") p_param "$@"; p_init "$P_DOWN" IP_DOWN "$*"; { r_pts_goingdown; r_parts DOWN; } 2>&1 | p_log;; *) echo "called with invalid name: $0" >&2; exit 1;; esac #!/bin/sh # /etc/dhcp3/dhclient-exit-hooks.d dhcp-ip-up -ci "-vD" -- \ # This script is run after interface routes are modified # Copyright (C) 2003 by Richard Hawes # This is free software; see the GNU General Public License version 2 # or later for copying conditions. There is NO warranty. # requires atd to run at current runlevel hash batch ps||exit; DELAY=30; exec 3<>/dev/null; set -- $new_routers $routers if { [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \ [ x$reason = xREBIND ] || [ x$reason = xREBOOT ]; }&& [ "x$new_domain_name" != x ]&&[ $# -gt 0 ];then ( # in case of interface started at bootup for I in 0 1 2 3 4 5 6 7 8 9; do ps -C atd >&3 || { sleep $DELAY; continue;} export \ IFNAME=$interface\ DEVICE=$interface\ SPEED=2000000\ IPLOCAL=$new_ip_address\ IPREMOTE=$1; echo /etc/ppp/ip-up $IFNAME $DEVICE $SPEED $IPLOCAL $IPREMOTE \ "$new_domain_name" | batch break done ) 2>&3 >&3 & fi #set >/tmp/dhcp-exit.env #!/bin/sh # /etc/dhcp3/dhclient-enter-hooks.d dhcp-ip-goingdown -ci "-vD" -- \ # This script is run before interface routes are modified # Copyright (C) 2003 by Richard Hawes # This is free software; see the GNU General Public License version 2 # or later for copying conditions. There is NO warranty. if [ x$reason = xRENEW ] || [ x$reason = xREBIND ] [ x$reason = xEXPIRE ] || [ x$reason = xTIMEOUT ]; then /etc/ppp/ip-goingdown $interface fi #set >/tmp/dhcp-enter.env #!/bin/sh # /etc/init.d _dhcp3-client -ci "-vbD" -- \ # _dhcp3-client start and stop complex interfaces # Copyright (C) 2003 by Richard Hawes # This is free software; see the GNU General Public License version 2 # or later for copying conditions. There is NO warranty. # $Revision: 1.1 $ # start and stop complex interfaces # that need to be started per run level and stopped earlier in halt and reboot # put at beginning of a line in the configuration file: #COMPLEX_IFACE= # followed by a space separated list of interface names DHCLIENT_CONF=/etc/dhcp3/dhclient.conf PATH=/bin:/usr/bin:/sbin:/usr/sbin PROG=_dhcp3-client; exec 3<>/dev/null; ifdown_check() { netstat -i | grep "^$1" 2>&1 >/dev/null; } ifup_check() { ! ifdown_check $1; } get_complex() { grep '^#COMPLEX_IFACE=' $DHCLIENT_CONF | sed 's/#COMPLEX_IFACE=//' } do_complex() { local action="$1";shift; while [ $# -gt 0 ]; do if ${action}_check $1;then echo -n "$1 "; if [ x$action = xifdown ];then /etc/ppp/ip-goingdown $1; fi $action --force $1; fi shift; done echo; } hash dhclient ifup ifdown 2>/dev/null||exit; case "$1" in start) echo -n "Starting Complex dhclient interfaces: "; do_complex ifup `get_complex`; ;; stop) echo -n "Stopping Complex dhclient interfaces: "; do_complex ifdown `get_complex`; ;; *) echo "Usage: /etc/init.d/$PROG {start|stop}" exit 1 esac exit 0 #!/bin/sh -e # /usr/local/sbin ip-goingdown-conf -ci "-vbD" -- \ # ip-goingdown-conf -- This script configures ip-goingdown for a device RVS='$Revision: 1.3 $';version(){ cat < This is free software; see the GNU General Public License version 2 or later for copying conditions. There is NO warranty. VRS exit; } #ev(){ eval "$@";} #er(){ warn ERROR: "$@";exit 1;} help(){ cat <&2;} OH=help; OV=version; P0="ip-goingdown-conf "; OLD=/tmp/ip-goingdown-conf; ONE="H V"; exec 3<>/dev/null; GO="$ONE"; #hash cat echo ln mkdir||exit; while getopts "$GO" LR;do case $LR in V) $OV $RVS;; H|\?) $OH;; esac;GO=;done; shift $(($OPTIND-1)); [ $# -eq 1 ]||$OH; cd /etc/ppp; make_dir ip-up.d $1 ip-up.d; make_dir ip-goingdown.d $1 ip-down.d; make_dir ip-down.d $1; #!/bin/sh -u # /usr/local/sbin install-split -i "-vDb" -- \ # install split text files RCS='$Revision: 1.46 $'; version(){ cat < This is free software; see the GNU General Public License version 2 or later for copying conditions. There is NO warranty. VRS err_set; } _install(){ if check; then XLS=$( ls xx* )|| err_set&& { rbr_nxt echo "$DG :"| tee $CHG| arkiv $OLD|| err_set;}&& rbr_nxt : "$DG"&& $DG touch -t 200101010000 $NEW&& { [ -z "$DG" ]|| mv $CHG ${CHG}.debug; } fi } _reinstall(){ restor "$NEW" "$OLD";} _uninstall(){ restor "$OLD" "$NEW";} arkiv(){ xargs -r ls 2>&3| $DG cpio -ovF $1 -H newc;} check(){ if [ ! -e $CHG ]; then if [ "$MD5" ]&& [ -e "$MD5" ]; then if [ $MWC -eq `wc -c <$MD5` ]; then md5sum -vc $MD5|| err_set; else error $MD5 size is not $MWC; fi fi else error ${Oi}ed previously\?; fi } evalu(){ eval "$@"|| err_set;} error(){ warn ERROR: "$@"; err_set;} err_get(){ return $errno;} err_set(){ errno=1; return 1;} help(){ echo "USAGE: $P0-[$ONE] [ -C config_file | -o eval_options . . . ] dir" for LR in $ONE; do evalu echo \"\ -$LR\ --\ \$O$LR\";done echo "second line of each file contains: $LN2" err_set; } restor(){ if [ -e $CHG ]; then if [ $2 -ot $1 ]; then arkiv $2 <$CHG|| err_set; err_get&& $DG xargs -r rm -f <$CHG&& $DG cpio -ivmuF $1|| err_set; else error $2 is newer than $1; fi else error not ${Oi}ed; fi } rbr_nxt(){ RBR=$1; NXT="$2"; for XXN in $XLS; do if { read LN1&& read $LN2;}<$XXN&& [ "$DIR" ]&&[ "$BAS" ]&&[ "$PRM" ];then evalu xxprm $PRM; fi; done; err_get&& evalu $ERN; } warn(){ echo "$@" >&2;} opt_c(){ $RBR "$FIL";} opt_i(){ $NXT $Oi "$@" $XXN "$FIL"&& $NXT rm $XXN|| err_set;} opt_s(){ local SYM; $NXT cd "$DIR"|| return 0; for SYM in "$@"; do $RBR "$DIR/$SYM"; $NXT ln -fvs "$BAS" "$SYM"|| err_set; done $NXT cd - >&3; } xxprm(){ FIL="$DIR/$BAS"; OPTIND=1; while getopts "ci:s:$EOP" LR; do [ "$LR" = '?' ]&& break|| opt_$LR ${OPTARG:-}; done; } OH=help; OV=version; Oi=install; Or=re$Oi; Ou=un$Oi; P0="$Oi-split "; CHG=change.list; EOP=; ERN=; LN2="COM DIR BAS PRM"; MD5=; MWC=; NEW=new.cpio; OLD=old.cpio; ONE="H V i r u"; DG=; [ -z "${INSTALL_SPLIT_DEBUG:-}" ]|| DG=warn; errno=0; exec 3<>/dev/null; SN=; hash cat cpio echo install ln md5sum mv rm tee touch wc xargs|| err_set; err_get&& while getopts "C:o:X$ONE" LR; do case $LR in C) . "$OPTARG";; H) $OH;; X) set -x;; V) $OV $RCS;; [iru]) SN=O$LR;; o) evalu $OPTARG;; \?) err_set;; esac|| break; done; shift $(($OPTIND-1)); [ $# -lt 2 ]|| set_err; if err_get; then [ $# -eq 0 ]|| cd "$1"&& evalu echo $P0 \$$SN&& evalu _\$$SN; fi err_get; # ~CSPLIT # /etc/ppp ip-conf -ci "-vbDm 644" -- \ # configuration file for /etc/ppp/ip-up # compensate for programs that do not wait 1 second before reading route table _DELAY=1; #_LOG_OPT="-p user.debug"; #_NICE_GOINGDOWN=; #_NICE_DOWN=; # compensate for diald running at augmented priority _NICE_UP=+0; #D_DOWN="$_ETC/ip-down.d"; #D_GOINGDOWN="$_ETC/ip-goingdown.d"; #D_UP="$_ETC/ip-up.d"; #E_PREDOWN=":"; #E_PREGOINGDOWN=":"; #E_PREUP=":"; #E_POSTDOWN=":"; #E_POSTGOINGDOWN=":"; #E_POSTUP=":"; #TMPDIR=/ramdisk/ppp; #!/usr/bin/suidperl -w # /usr/local/bin ip-goingdown-wrapper -ci "-vDm 4750 -g dialout" -- \ # ip-goingdown-wrapper -- This script handles ip-goingdown for ppp my $revision = '$Revision: 1.10 $'; sub copyleft { print <<"COPYLEFT"; Copyright (C) 2003 by Richard L. Hawes This is free software; see the GNU General Public License version 2 or later for copying conditions. There is NO warranty. latest version: www.dma.org/~rhawes/programs/ip-goingdown-wrapper COPYLEFT } use strict; sub help { print <<"HELP"; USAGE: ip-goingdown-wrapper "interface_name" secure suid wrapper for /etc/ppp/ip-goingdown HELP } sub version { print STDOUT 'ip-goingdown-wrapper ', ( split(' ', $revision ) )[1], "\n" ; copyleft; } BEGIN { $ENV{PATH} = '/bin:/usr/bin'; $ENV{SHELL} = '/bin/sh' if exists $ENV{SHELL}; delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; } my $goingdown = "/etc/ppp/ip-goingdown"; for ( @ARGV ) { if(/--version/) { version(); last; } if(/--help/) { help(); last; } exec $goingdown, $_; } d3affd2c23780218c3a285b9f0ec7a92 xx00 81e5a34bab95ae41e2d12a824e6466ea xx01 32944171c84ee42161c3d28b96f7ea2f xx02 b8c0e88eaee97c2ea603b6754404b7cc xx03 2aa405039ecf64f13f2bb8fdb4eddef3 xx04 74aaf2cf75d206d39994fc59ebeeeeb7 xx05 1f56dc0966f8de76c45ea79336ac2afb xx06 b752af987d6a8146ae065015e3677b3b xx07 2b7628041335b5f2e3b78227e953b1d9 xx08 7c96d8befd184c225886343fd6391422 xx09