summaryrefslogtreecommitdiffstats
path: root/etc/rc.d/isdnd
blob: 87c8a40b1c2cdbacc1424e2f286cf2e7d1149f02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/sh
#
# $NetBSD: isdnd,v 1.2 2001/01/07 17:53:36 martin Exp $
#

# PROVIDE: isdnd
# REQUIRE: NETWORK syslogd mountcritremote

. /etc/rc.subr

name="isdnd"
rcvar=$name
required_files="/etc/isdn/${name}.rc"

command="/usr/sbin/${name}"
pidfile="/var/run/${name}.pid"

load_rc_config $name
run_rc_command "$1"

if checkyesno isdnd && checkyesno isdn_autoupdown; then
	
	# The isdn network interfaces could not be marked UP in the
	# ifconfig.* files, since the daemon wasn't available then.
	# If we are doing start: now it's running, so figure which
	# interfaces these applies to and UP them. If doing stop: 
	# down them (for symetry, and effectively they are down).

	case "$_arg" in
	  start)
		ifflag="-d"
		ifcmd="up"
		;;
	  stop)
		ifflag="-u"
		ifcmd="down"
		;;
	  *)
		exit 0
		;;
	esac

	if [ -z "$isdn_interfaces" ]; then
		# the user has not specified a list of interface
		# to track isdnd - try to figure ourselfs
		tmp=`ifconfig -l $ifflag`
		for int in $tmp; do
			# Check if the interface has been configured at all
			# XXX - does this work with IPv6 ?
			if ifconfig $int | fgrep inet >/dev/null; then
				case $int in
				isp*)
					isdn_interfaces="$isdn_interfaces $int"
					;;
				ipr*)
					isdn_interfaces="$isdn_interfaces $int"
					;;
				esac
			fi
		done
	fi
	for int in $isdn_interfaces; do
		ifconfig $int $ifcmd
	done
fi

OpenPOWER on IntegriCloud