View | Details | Raw Unified | Return to bug 11647
Collapse All | Expand All

(-)a/contrib/Makefile (-1 / +3 lines)
Lines 45-55 install: Link Here
45
	@install -m 755 etc/net/scripts/contrib/* $(etcnetdir)/scripts/contrib
45
	@install -m 755 etc/net/scripts/contrib/* $(etcnetdir)/scripts/contrib
46
	@install -m 644 etc/net/scripts/functions* $(etcnetdir)/scripts
46
	@install -m 644 etc/net/scripts/functions* $(etcnetdir)/scripts
47
	@install -m 755 etc/net/scripts/{config-,create-,destroy-,ifdown,ifup,setup-,shutdown-}* $(etcnetdir)/scripts
47
	@install -m 755 etc/net/scripts/{config-,create-,destroy-,ifdown,ifup,setup-,shutdown-}* $(etcnetdir)/scripts
48
	@install -m 755 etc/net/scripts/{ifplugd.action,network.init} $(etcnetdir)/scripts
48
	@install -m 755 etc/net/scripts/{ifplugd.action,wpa_cli.action,network.init} $(etcnetdir)/scripts
49
	@install -m 644 etc/net/sysctl.conf $(etcnetdir)
49
	@install -m 644 etc/net/sysctl.conf $(etcnetdir)
50
	@install -d $(mandir)/man{5,8}
50
	@install -d $(mandir)/man{5,8}
51
	@install -m 644 docs/*.8 $(mandir)/man8
51
	@install -m 644 docs/*.8 $(mandir)/man8
52
	@install -m 644 docs/*.5 $(mandir)/man5
52
	@install -m 644 docs/*.5 $(mandir)/man5
53
	@ln -s ifup-ifplugd $(etcnetdir)/scripts/ifup-wireless
54
	@ln -s ifdown-ifplugd $(etcnetdir)/scripts/ifdown-wireless
53
55
54
# 2. Install aux files.
56
# 2. Install aux files.
55
	@install -D -m 644 etc/sysconfig/network $(sysconfdir)/network
57
	@install -D -m 644 etc/sysconfig/network $(sysconfdir)/network
(-)a/etc/net/scripts/config-wireless (-6 / +9 lines)
Lines 29-38 if [ -x "${IWCONFIG:=$DEFAULT_IWCONFIG}" ]; then Link Here
29
fi
29
fi
30
30
31
# configure WPA
31
# configure WPA
32
if [ -x "${WPA_SUPPLICANT:=$DEFAULT_WPA_SUPPLICANT}" ]; then
32
prof_conf=`profiled_filename $MYIFACEDIR/wpa_supplicant.conf`
33
	prof_conf=`profiled_filename $MYIFACEDIR/wpa_supplicant.conf`
33
if [ -x "${WPA_SUPPLICANT:=$DEFAULT_WPA_SUPPLICANT}" -a \
34
	if [ -s "$prof_conf" ]; then
34
	-x "${WPA_CLI:=$DEFAULT_WPA_CLI}" -a \
35
		$WPA_SUPPLICANT -i$NAME${WPA_DRIVER:+ -D$WPA_DRIVER} -c $prof_conf 2>&1>/dev/null &
35
	-s "$prof_conf" ]; then
36
		echo $! >/var/run/wpa_supplicant-$NAME.pid
36
	$WPA_SUPPLICANT -i$NAME${WPA_DRIVER:+ -D$WPA_DRIVER} \
37
	fi
37
		-B -P/var/run/wpa_supplicant-$NAME.pid -c $prof_conf && \
38
	$WPA_CLI -i$NAME -B -P/var/run/wpa_cli-$NAME.pid -a $SCRIPTDIR/wpa_cli.action
39
else
40
	exit 2		# continue without wpa_cli
38
fi
41
fi
(-)a/etc/net/scripts/functions (-1 / +2 lines)
Lines 18-23 DEFAULT_IFPLUGD=/usr/sbin/ifplugd Link Here
18
DEFAULT_IWPRIV=/sbin/iwpriv
18
DEFAULT_IWPRIV=/sbin/iwpriv
19
DEFAULT_IWCONFIG=/sbin/iwconfig
19
DEFAULT_IWCONFIG=/sbin/iwconfig
20
DEFAULT_WPA_SUPPLICANT=/usr/sbin/wpa_supplicant
20
DEFAULT_WPA_SUPPLICANT=/usr/sbin/wpa_supplicant
21
DEFAULT_WPA_CLI=/usr/sbin/wpa_cli
21
DEFAULT_PLIPCONFIG=/sbin/plipconfig
22
DEFAULT_PLIPCONFIG=/sbin/plipconfig
22
DEFAULT_VCONFIG=/usr/bin/vconfig
23
DEFAULT_VCONFIG=/usr/bin/vconfig
23
DEFAULT_IPSECADM=/usr/sbin/ipsecadm
24
DEFAULT_IPSECADM=/usr/sbin/ipsecadm
Lines 501-507 declare -frx modprobe_with_rename Link Here
501
declare -frx eval_string
502
declare -frx eval_string
502
declare -rx DENOISE DEFAULT_BONDMODE IFACEDIR LOCALSCRIPTDIR VARLIBDIR
503
declare -rx DENOISE DEFAULT_BONDMODE IFACEDIR LOCALSCRIPTDIR VARLIBDIR
503
declare -rx VLANTAB HOSTTAB IFTAB PROFILE_FILE PROC_CMDLINE DEFAULT_IFPLUGSTATUS
504
declare -rx VLANTAB HOSTTAB IFTAB PROFILE_FILE PROC_CMDLINE DEFAULT_IFPLUGSTATUS
504
declare -rx DEFAULT_IFPLUGD DEFAULT_IWCONFIG DEFAULT_WPA_SUPPLICANT DEFAULT_PLIPCONFIG
505
declare -rx DEFAULT_IFPLUGD DEFAULT_IWCONFIG DEFAULT_WPA_SUPPLICANT DEFAULT_WPA_CLI DEFAULT_PLIPCONFIG
505
declare -rx DEFAULT_VCONFIG DEFAULT_PENTANETT DEFAULT_PENTAVALT DEFAULT_PENTANET_CONF
506
declare -rx DEFAULT_VCONFIG DEFAULT_PENTANETT DEFAULT_PENTAVALT DEFAULT_PENTANET_CONF
506
declare -rx DEFAULT_PENTAVAL_CONF DEFAULT_IPSECADM DEFAULT_IFENSLAVE DEFAULT_BRCTL
507
declare -rx DEFAULT_PENTAVAL_CONF DEFAULT_IPSECADM DEFAULT_IFENSLAVE DEFAULT_BRCTL
507
declare -rx DEFAULT_ETHTOOL DEFAULT_PPPD DEFAULT_CHAT DEFAULT_PPPOPTIONSFILE
508
declare -rx DEFAULT_ETHTOOL DEFAULT_PPPD DEFAULT_CHAT DEFAULT_PPPOPTIONSFILE
(-)a/etc/net/scripts/functions-eth (+11 lines)
Lines 15-20 check_eth_link () Link Here
15
	return 0
15
	return 0
16
}
16
}
17
17
18
# checks, if given iface is wireless one
19
is_wireless ()
20
{
21
	# FIXME better way ?
22
	if [ -d "/sys/class" ]; then
23
		[ -d "/sys/class/net/$1/wireless" ]
24
	else
25
		grep -q "^[[:blank:]]*$1:" /proc/net/wireless
26
	fi
27
}
28
18
# see ifaces/default/options-eth
29
# see ifaces/default/options-eth
19
wait_for_macaddr()
30
wait_for_macaddr()
20
{
31
{
(-)a/etc/net/scripts/ifdown-ifplugd (-6 / +8 lines)
Lines 51-65 case "$BOOTPROTO" in Link Here
51
	;;
51
	;;
52
esac
52
esac
53
53
54
case "$USE_IFPLUGD" in
54
if [ "${0##/*}" = "ifdown-ifplugd" ]; then
55
	[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|[Yy]|1|[Aa][Uu][Tt][Oo])
55
	case "$USE_IFPLUGD" in
56
		[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|[Yy]|1|[Aa][Uu][Tt][Oo])
56
		# It's Ok, just do the job.
57
		# It's Ok, just do the job.
57
	;;
58
		;;
58
	*)
59
		*)
59
		print_error "ERROR: USE_IFPLUGD is not enabled for $NAME"
60
		print_error "ERROR: USE_IFPLUGD is not enabled for $NAME"
60
		exit 1
61
		exit 1
61
	;;
62
		;;
62
esac
63
	esac
64
fi
63
65
64
ExecIfExecutable $LOCALSCRIPTDIR/ifdown-pre-local $NAME && print_progress
66
ExecIfExecutable $LOCALSCRIPTDIR/ifdown-pre-local $NAME && print_progress
65
ExecIfExecutable $MYIFACEDIR/ifdown-pre $NAME && print_progress
67
ExecIfExecutable $MYIFACEDIR/ifdown-pre $NAME && print_progress
(-)a/etc/net/scripts/ifup-common (-6 / +19 lines)
Lines 39-44 case "$USE_IFPLUGD" in Link Here
39
		# A and D
39
		# A and D
40
		if ! is_yes "$IN_IFPLUGD"; then
40
		if ! is_yes "$IN_IFPLUGD"; then
41
			# D
41
			# D
42
			! is_wireless $NAME || {
43
				print_error "ERROR: USE_IFPLUGD=yes for $NAME, wireless card is unsupported"
44
				exit 1
45
			}
42
			! is_yes "$HAVE_IFPLUGD" && exit 1
46
			! is_yes "$HAVE_IFPLUGD" && exit 1
43
			if is_yes "$PERSISTENT_IFPLUGD"; then
47
			if is_yes "$PERSISTENT_IFPLUGD"; then
44
				if ! ifplugd_runs; then
48
				if ! ifplugd_runs; then
Lines 184-201 process_sysctl_conf() Link Here
184
	return 0
188
	return 0
185
}
189
}
186
190
191
if ! is_yes $IN_WPA_CLI; then	# non-wifi or first pass for wifi
187
# setup link-level params
192
# setup link-level params
188
xargise_file $IFACEDIR/default/iplink "$IP link set dev $NAME"
193
    xargise_file $IFACEDIR/default/iplink "$IP link set dev $NAME"
189
xargise_file $IFACEDIR/default/iplink-$TYPE "$IP link set dev $NAME"
194
    xargise_file $IFACEDIR/default/iplink-$TYPE "$IP link set dev $NAME"
190
xargise_file $MYIFACEDIR/iplink "$IP link set dev $NAME"
195
    xargise_file $MYIFACEDIR/iplink "$IP link set dev $NAME"
191
196
192
# bring iface up
197
# bring iface up
193
if ! is_yes $KEEP_DOWN; then
198
    if ! is_yes $KEEP_DOWN; then
194
	$IP link set dev $NAME up && print_progress
199
	$IP link set dev $NAME up && print_progress
200
    fi
195
fi
201
fi
196
202
197
# handle wireless extensions
203
# handle wireless extensions, if any
198
is_yes "$CONFIG_WIRELESS" && $SCRIPTDIR/config-wireless $NAME && print_progress
204
if is_yes "$CONFIG_WIRELESS" && is_wireless $NAME; then
205
    if ! is_yes $IN_WPA_CLI; then
206
	$SCRIPTDIR/config-wireless $NAME
207
	rc=$?
208
	[ $rc -eq 2 ] || exit $rc
209
	print_progress
210
    fi
211
fi
199
212
200
# process ip neighbours
213
# process ip neighbours
201
xargise_file $MYIFACEDIR/ipneigh "$IP neigh replace dev $NAME"
214
xargise_file $MYIFACEDIR/ipneigh "$IP neigh replace dev $NAME"
(-)a/etc/net/scripts/ifup-ifplugd (-2 / +13 lines)
Lines 13-19 usage() Link Here
13
[ -z "$1" ] && usage
13
[ -z "$1" ] && usage
14
export NAME=$1
14
export NAME=$1
15
15
16
# forget everything we have inherited from ifplugd
16
# forget everything we have inherited from ifplugd/wpa_cli
17
export SCRIPTDIR=/etc/net/scripts
17
export SCRIPTDIR=/etc/net/scripts
18
. $SCRIPTDIR/functions
18
. $SCRIPTDIR/functions
19
pickup_defaults
19
pickup_defaults
Lines 37-40 is_yes "$DISABLED" && { Link Here
37
seen_iface $NAME && exit 0
37
seen_iface $NAME && exit 0
38
add_seen_iface $NAME
38
add_seen_iface $NAME
39
export SEEN_IFACES
39
export SEEN_IFACES
40
IN_IFPLUGD=yes $SCRIPTDIR/ifup-common $NAME
40
41
case "${0##*/}" in
42
    ifup-ifplugd)
43
    IN_WPA_CLI=no IN_IFPLUGD=yes $SCRIPTDIR/ifup-common $NAME
44
    ;;
45
    ifup-wireless)
46
    USE_IFPLUGD=no IN_IFPLUGD=no IN_WPA_CLI=yes $SCRIPTDIR/ifup-common $NAME
47
    ;;
48
    *)
49
    $SCRIPTDIR/ifup-common $NAME
50
    ;;
51
esac
(-)a/etc/net/scripts/wpa_cli.action (+17 lines)
Line 0 Link Here
1
#!/bin/sh
2
3
# This file is /etc/net helper for use with wpa_cli action mode
4
# and called from wpa_cli with two parameters:
5
# $1 interface name
6
# $2 event, CONNECTED|DISCONNECTED
7
8
if [ -z "$1" -o -z "$2" ] ; then
9
    logger -d "Wrong arguments to $0: '$@'"
10
    exit 1
11
fi
12
13
unset SEEN_IFACES
14
[ "$2" = "CONNECTED" ] && exec /etc/net/scripts/ifup-wireless $1
15
[ "$2" = "DISCONNECTED" ] && exec /etc/net/scripts/ifdown-wireless $1
16
17
exit 0

Return to bug 11647