head	1.7;
access;
symbols
	perseant-exfatfs-base-20250801:1.7
	perseant-exfatfs-base-20240630:1.7
	perseant-exfatfs:1.7.0.12
	perseant-exfatfs-base:1.7
	cjep_sun2x:1.7.0.10
	cjep_sun2x-base:1.7
	cjep_staticlib_x-base1:1.7
	cjep_staticlib_x:1.7.0.8
	cjep_staticlib_x-base:1.7
	phil-wifi-20200421:1.7
	phil-wifi-20200411:1.7
	phil-wifi-20200406:1.7
	pgoyette-compat-merge-20190127:1.7
	pgoyette-compat-20190127:1.7
	pgoyette-compat-20190118:1.7
	pgoyette-compat-1226:1.7
	pgoyette-compat-1126:1.7
	pgoyette-compat-1020:1.7
	pgoyette-compat-0930:1.7
	pgoyette-compat-0906:1.7
	netbsd-7-2-RELEASE:1.1.1.4.6.2
	pgoyette-compat-0728:1.7
	pgoyette-compat-0625:1.7
	pgoyette-compat-0521:1.7
	pgoyette-compat-0502:1.7
	pgoyette-compat-0422:1.7
	pgoyette-compat-0415:1.7
	pgoyette-compat-0407:1.7
	pgoyette-compat-0330:1.7
	pgoyette-compat-0322:1.7
	pgoyette-compat-0315:1.7
	netbsd-7-1-2-RELEASE:1.1.1.4.6.1
	pgoyette-compat:1.7.0.6
	pgoyette-compat-base:1.7
	netbsd-7-1-1-RELEASE:1.1.1.4.6.1
	perseant-stdc-iso10646:1.7.0.4
	perseant-stdc-iso10646-base:1.7
	prg-localcount2-base3:1.7
	prg-localcount2-base2:1.7
	prg-localcount2-base1:1.7
	prg-localcount2:1.7.0.2
	prg-localcount2-base:1.7
	pgoyette-localcount-20170426:1.7
	bouyer-socketcan-base1:1.7
	pgoyette-localcount-20170320:1.6
	netbsd-7-1:1.1.1.4.6.1.0.6
	netbsd-7-1-RELEASE:1.1.1.4.6.1
	netbsd-7-1-RC2:1.1.1.4.6.1
	netbsd-7-nhusb-base-20170116:1.1.1.4.6.1
	bouyer-socketcan:1.6.0.4
	bouyer-socketcan-base:1.6
	pgoyette-localcount-20170107:1.6
	netbsd-7-1-RC1:1.1.1.4.6.1
	pgoyette-localcount-20161104:1.6
	netbsd-7-0-2-RELEASE:1.1.1.4.6.1
	dhcpcd-6-11-4-reimport:1.1.1.7
	dhcpcd-6-11-4:1.1.1.7
	localcount-20160914:1.6
	netbsd-7-nhusb:1.1.1.4.6.1.0.4
	netbsd-7-nhusb-base:1.1.1.4.6.1
	dhcpcd-6-11-3:1.1.1.7
	pgoyette-localcount-20160806:1.6
	dhcpcd-6-11-2:1.1.1.7
	pgoyette-localcount-20160726:1.6
	pgoyette-localcount:1.6.0.2
	pgoyette-localcount-base:1.6
	dhcpcd-6-11-1:1.1.1.7
	netbsd-7-0-1-RELEASE:1.1.1.4.6.1
	dhcpcd-6-11-0:1.1.1.7
	dhcpcd-6-10-3:1.1.1.7
	dhcpcd-6-10-2:1.1.1.7
	dhcpcd-6-10-1:1.1.1.7
	dhcpcd-6-10-0:1.1.1.7
	dhcpcd-6-9-4:1.1.1.7
	netbsd-7-0:1.1.1.4.6.1.0.2
	netbsd-7-0-RELEASE:1.1.1.4.6.1
	dhcpcd-6-9-3:1.1.1.7
	dhcpcd-6-9-2:1.1.1.7
	netbsd-7-0-RC3:1.1.1.4.6.1
	netbsd-7-0-RC2:1.1.1.4.6.1
	dhcpcd-6-9-1:1.1.1.7
	netbsd-7-0-RC1:1.1.1.4.6.1
	dhcpcd-6-9-0:1.1.1.7
	dhcpcd-6-8-2:1.1.1.7
	dhcpcd-6-8-1:1.1.1.7
	dhcpcd-6-8-0:1.1.1.7
	dhcpcd-6-7-1:1.1.1.7
	dhcpcd-6-7-0:1.1.1.7
	dhcpcd-6-6-7:1.1.1.7
	dhcpcd-6-6-6:1.1.1.7
	dhcpcd-6-6-5:1.1.1.7
	dhcpcd-6-6-4:1.1.1.7
	dhcpcd-6-6-3:1.1.1.7
	dhcpcd-6-6-2:1.1.1.7
	dhcpcd-6-6-1-nb1:1.1.1.7
	dhcpcd-6-6-1:1.1.1.6
	dhcpcd-6-6-0:1.1.1.5
	dhcpcd-6-5-1:1.1.1.5
	dhcpcd-6-5-0:1.1.1.5
	dhcpcd-6-4-7:1.1.1.5
	dhcpcd-6-4-6:1.1.1.5
	dhcpcd-6-4-5:1.1.1.5
	dhcpcd-6-4-4:1.1.1.5
	netbsd-7:1.1.1.4.0.6
	netbsd-7-base:1.1.1.4
	dhcpcd-6-4-3:1.1.1.4
	dhcpcd-6-4-2:1.1.1.4
	dhcpcd-6-4-1:1.1.1.4
	dhcpcd-6-4-0:1.1.1.4
	yamt-pagecache:1.1.1.4.0.4
	yamt-pagecache-base9:1.1.1.4
	tls-earlyentropy:1.1.1.4.0.2
	tls-earlyentropy-base:1.1.1.4
	riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.1.1.4
	riastradh-drm2-base3:1.1.1.4
	dhcpcd-6-3-2:1.1.1.4
	dhcpcd-6-3-1:1.1.1.4
	dhcpcd-6-3-0:1.1.1.3
	dhcpcd-6-2-1:1.1.1.2
	dhcpcd-6-2-0:1.1.1.2
	dhcpcd-6-1-0:1.1.1.1
	dhcpcd-6-0-5:1.1.1.1
	dhcpcd-6-0-4:1.1.1.1
	riastradh-drm2-base2:1.1.1.1
	riastradh-drm2-base1:1.1.1.1
	dhcpcd-6-0-3:1.1.1.1
	riastradh-drm2:1.1.1.1.0.4
	riastradh-drm2-base:1.1.1.1
	tls-maxphys-base:1.1.1.4
	tls-maxphys:1.1.1.1.0.2
	dhcpcd-6-0-1:1.1.1.1
	dhcpcd_6_0_0:1.1.1.1
	roy:1.1.1;
locks; strict;
comment	@# @;


1.7
date	2017.03.31.20.53.56;	author roy;	state dead;
branches;
next	1.6;
commitid	dLxJqjjcfoFGgKLz;

1.6
date	2014.11.07.20.51.03;	author roy;	state Exp;
branches
	1.6.2.1
	1.6.4.1;
next	1.5;
commitid	75oEB7w8hHnrniXx;

1.5
date	2014.11.07.20.43.33;	author roy;	state Exp;
branches;
next	1.4;
commitid	hAQ3M4m1B34VkiXx;

1.4
date	2014.11.07.20.32.05;	author roy;	state Exp;
branches;
next	1.3;
commitid	SjGER4FFqwIXgiXx;

1.3
date	2014.10.17.23.42.25;	author roy;	state Exp;
branches;
next	1.2;
commitid	9G64jKP8UtP60CUx;

1.2
date	2014.10.06.18.22.30;	author roy;	state Exp;
branches;
next	1.1;
commitid	brDOONtoZlOhAaTx;

1.1
date	2013.06.21.19.33.08;	author roy;	state Exp;
branches
	1.1.1.1;
next	;
commitid	SXn20EEvZ4In4wUw;

1.6.2.1
date	2017.04.26.02.52.23;	author pgoyette;	state dead;
branches;
next	;
commitid	ojV02aOSdzvBqZOz;

1.6.4.1
date	2017.04.21.16.51.23;	author bouyer;	state dead;
branches;
next	;
commitid	dUG7nkTKALCadqOz;

1.1.1.1
date	2013.06.21.19.33.08;	author roy;	state Exp;
branches
	1.1.1.1.2.1;
next	1.1.1.2;
commitid	SXn20EEvZ4In4wUw;

1.1.1.2
date	2014.01.03.22.10.44;	author roy;	state Exp;
branches;
next	1.1.1.3;
commitid	0INAS2yPnkFaIIjx;

1.1.1.3
date	2014.02.25.13.14.31;	author roy;	state Exp;
branches;
next	1.1.1.4;
commitid	ic8VDg7Vv5gD2uqx;

1.1.1.4
date	2014.03.01.11.00.43;	author roy;	state Exp;
branches
	1.1.1.4.4.1
	1.1.1.4.6.1;
next	1.1.1.5;
commitid	tXEmLo8IxYZRaZqx;

1.1.1.5
date	2014.09.16.22.23.21;	author roy;	state Exp;
branches;
next	1.1.1.6;
commitid	VYSyBEUwq9SmyCQx;

1.1.1.6
date	2014.11.07.20.24.03;	author roy;	state Exp;
branches;
next	1.1.1.7;
commitid	r3g7iXT9fDtAdiXx;

1.1.1.7
date	2014.11.07.20.41.32;	author roy;	state Exp;
branches;
next	;
commitid	oii7SeL5oq7JjiXx;

1.1.1.1.2.1
date	2013.06.21.19.33.08;	author tls;	state dead;
branches;
next	1.1.1.1.2.2;
commitid	OnlO1cBgtQRcIHUw;

1.1.1.1.2.2
date	2013.06.23.06.26.31;	author tls;	state Exp;
branches;
next	1.1.1.1.2.3;
commitid	OnlO1cBgtQRcIHUw;

1.1.1.1.2.3
date	2014.08.19.23.46.43;	author tls;	state Exp;
branches;
next	;
commitid	jTnpym9Qu0o4R1Nx;

1.1.1.4.4.1
date	2014.03.01.11.00.43;	author yamt;	state dead;
branches;
next	1.1.1.4.4.2;
commitid	bCgsIAYejpvb7yBx;

1.1.1.4.4.2
date	2014.05.22.15.44.40;	author yamt;	state Exp;
branches;
next	;
commitid	bCgsIAYejpvb7yBx;

1.1.1.4.6.1
date	2014.12.29.16.18.05;	author martin;	state Exp;
branches;
next	1.1.1.4.6.2;
commitid	rwbq7QmIjmQl9X3y;

1.1.1.4.6.2
date	2018.07.27.10.43.20;	author martin;	state dead;
branches;
next	;
commitid	HmTKhyRj9OTCmLLA;


desc
@@


1.7
log
@Sync
@
text
@# $NetBSD: 10-wpa_supplicant,v 1.6 2014/11/07 20:51:03 roy Exp $

# Start, reconfigure and stop wpa_supplicant per wireless interface.
# This is needed because wpa_supplicant lacks hotplugging of any kind
# and the user should not be expected to have to wire it into their system
# if the base system doesn't do this itself.

if [ -z "$wpa_supplicant_conf" ]; then
	for x in \
		/etc/wpa_supplicant/wpa_supplicant-"$interface".conf \
		/etc/wpa_supplicant/wpa_supplicant.conf \
		/etc/wpa_supplicant-"$interface".conf \
		/etc/wpa_supplicant.conf \
	; do
		if [ -s "$x" ]; then
			wpa_supplicant_conf="$x"
			break
		fi
	done
fi
: ${wpa_supplicant_conf:=/etc/wpa_supplicant.conf}

wpa_supplicant_ctrldir()
{
	local dir

	dir=$(key_get_value "[[:space:]]*ctrl_interface=" \
		"$wpa_supplicant_conf")
	dir=$(trim "$dir")
	case "$dir" in
	DIR=*)
		dir=${dir##DIR=}
		dir=${dir%%[[:space:]]GROUP=*}
		dir=$(trim "$dir")
		;;
	esac
	printf %s "$dir"
}

wpa_supplicant_start()
{
	local dir err errn

	# If the carrier is up, don't bother checking anything
	[ "$ifcarrier" = "up" ] && return 0

	# Pre flight checks
	if [ ! -s "$wpa_supplicant_conf" ]; then
		syslog warn \
			"$wpa_supplicant_conf does not exist"
		syslog warn "not interacting with wpa_supplicant(8)"
		return 1
	fi
	dir=$(wpa_supplicant_ctrldir)
	if [ -z "$dir" ]; then
		syslog warn \
			"ctrl_interface not defined in $wpa_supplicant_conf"
		syslog warn "not interacting with wpa_supplicant(8)"
		return 1
	fi

	wpa_cli -p "$dir" -i "$interface" status >/dev/null 2>&1 && return 0
	syslog info "starting wpa_supplicant"
	driver=${wpa_supplicant_driver:+-D}$wpa_supplicant_driver
	err=$(wpa_supplicant -B -c"$wpa_supplicant_conf" -i"$interface" \
	    "$driver" 2>&1)
	errn=$?
	if [ $errn != 0 ]; then
		syslog err "failed to start wpa_supplicant"
		syslog err "$err"
	fi
	return $errn
}

wpa_supplicant_reconfigure()
{
	local dir err errn

	dir=$(wpa_supplicant_ctrldir)
	[ -z "$dir" ] && return 1
	if ! wpa_cli -p "$dir" -i "$interface" status >/dev/null 2>&1; then
		wpa_supplicant_start
		return $?
	fi
	syslog info "reconfiguring wpa_supplicant"
	err=$(wpa_cli -p "$dir" -i "$interface" reconfigure 2>&1)
	errn=$?
	if [ $errn != 0 ]; then
		syslog err "failed to reconfigure wpa_supplicant"
		syslog err "$err"
	fi
	return $errn
}

wpa_supplicant_stop()
{
	local dir err errn

	dir=$(wpa_supplicant_ctrldir)
	[ -z "$dir" ] && return 1
	wpa_cli -p "$dir" -i "$interface" status >/dev/null 2>&1 || return 0
	syslog info "stopping wpa_supplicant"
	err=$(wpa_cli -i"$interface" terminate 2>&1)
	errn=$?
	if [ $errn != 0 ]; then
		syslog err "failed to start wpa_supplicant"
		syslog err "$err"
	fi
	return $errn
}

if [ "$ifwireless" = "1" ] && \
    type wpa_supplicant >/dev/null 2>&1 && \
    type wpa_cli >/dev/null 2>&1
then
	case "$reason" in
	PREINIT)	wpa_supplicant_start;;
	RECONFIGURE)	wpa_supplicant_reconfigure;;
	DEPARTED)	wpa_supplicant_stop;;
	esac
fi
@


1.6
log
@Add RCSIDs
@
text
@d1 1
a1 1
# $NetBSD: $
@


1.6.2.1
log
@Sync with HEAD
@
text
@d1 1
a1 1
# $NetBSD: 10-wpa_supplicant,v 1.6 2014/11/07 20:51:03 roy Exp $
@


1.6.4.1
log
@Sync with HEAD
@
text
@d1 1
a1 1
# $NetBSD: 10-wpa_supplicant,v 1.6 2014/11/07 20:51:03 roy Exp $
@


1.5
log
@Sync
@
text
@d1 2
@


1.4
log
@Sync
@
text
@a0 2


@


1.3
log
@Sync
@
text
@d1 1
a1 1
# $NetBSD: $
@


1.2
log
@Sync
@
text
@@


1.1
log
@Initial revision
@
text
@d8 13
d23 17
d42 19
a60 1
	local err errn
d62 1
a62 1
	wpa_cli -i "$interface" status >/dev/null 2>&1 && return 0
d64 3
a66 1
	err=$(wpa_supplicant -B -c"$wpa_supplicant_conf" -i"$interface" 2>&1)
d77 1
a77 1
	local err errn
d79 3
a81 1
	if ! wpa_cli -i "$interface" status >/dev/null 2>&1; then
d86 1
a86 1
	err=$(wpa_cli -i"$interface" reconfigure 2>&1)
d97 1
a97 1
	local err errn
d99 3
a101 1
	wpa_cli -i "$interface" status >/dev/null 2>&1 || return 0
a110 1
	
d112 1
a112 1
if [ "$ifwireless" = "1" -a -s "$wpa_supplicant_conf" ] && \
@


1.1.1.1
log
@Import dhcpcd-6.0.0 with the following changes:
 * DHCPv6 support
 * wpa_supplicant hook script
 * route IPv4 addresses to 127.0.0.1 for machine centric traffic
 * DHCPv6 Prefix Delegation support
 * DHCPv6 FQDN support
 * Control existing IPv4 routes
 * less spamy to syslog by default
 * IPv6 protocols now wait for a valid LL address before starting
 * IPv6 DAD support now listens to kernel for more accurate timings
 * IPv4 code split out more cleanly so dhcpcd can be compiled for
   IPv4, IPv6 or IPv4 AND IPv6
 * MTU is no longer requested by default
 * a DUID is now generated in /etc/dhcpcd.duid and this is used as a
   client ID for DHCPv4 and DHCPv6
   This does mean that you may get new DHCPv4 addresses

Many bugs have also been fixed along the way and this release addresses
the following PR's

PR bin/47364
PR bin/47502
PR bin/47666
PR bin/47699
PR bin/47775
PR bin/47776
@
text
@@


1.1.1.2
log
@Import dhcpcd-6.2.0 with the following changes:

* Fix NAK backoff when a server NAKs a REQUEST after a DISCOVER.
* Fix IPv6 ICMP filtering on Android (RS/RA now works)
* Fix sending of DHCPv6 FQDN when only hostname specified
* Add support for RFC3925 Vendor-Identifying Vendor Options
* Remove hard coded DHCP/DHCPv6 options and embed dhcpcd-definitions.conf.
  This actually results in a slightly smaller binary than before and has the added advantage that the option definitions are now all held within one file.
* Change IAID to default from the last 4 bytes of the MAC address.
  Rationale in the commit, but in a nutshell it allows for a stable IAID between reboots without persistent storage and across different OS's who name or number it differently to each other.
* RFC4242, Information Refresh Time Option for DHCPv6.
* Fix processing of inet4 addr in vendor options and terminate correctly.
* Preserve vendor encapsulated options.
* Fix renewal of Prefix Delegation. Only spam the log if a lease has a new address or changes the vltime of an existing address.
* Add noipv4 and noipv6 options.
* Warn about missing interfaces which require prefix delegation.
* If we timeout, remove any waitip config so that we daemonise correctly.
* Remove the IPv6 forwarding router check as valid use cases exist where you would want IPv6 RS/RA on a router.
* Pass the correct run directory to dhcpcd-run-hooks
@
text
@a7 11
if [ -z "$wpa_supplicant_conf" ]; then
	for x in \
		/etc/wpa_supplicant.conf \
		/etc/wpa_supplicant/wpa_supplicant.conf \
	; do
		if [ -s "$x" ]; then
			wpa_supplicant_conf="$x"
			break
		fi
	done
fi
@


1.1.1.3
log
@Import dhcpcd-6.3.0 with the following changes:

 * IAID must be inside an interface block.
 * Detect IPv6 address flags on Linux.
 * Check that we have ctrl_interface defined in wpa_supplicant.conf and pass this parameter to wpa_cli(8). If not set, warn about not interacting with wpa_supplicant(8).
 * Skip Virtual Interface Masters. Currently this only applies to FreeBSD VAP masters as dhcpcd should only work on wlandev created clones.
 * Fix handling of ARP failures, thanks to Sebastian Huber.
 * Implement RFC 1321 MD5 Message-Digest if not provided in libc.
 * Implement RFC 2104 HMAC Keyed Hashing.
 * Implement RFC 3118 Authentication for DHCP Messages and RFC 3315 Authentication options.
 * Add nodhcp and nodhcp6 directives. Thanks to Sebastian Huber for the initial patch and testing.
 * Implement support for RFC 3203, FORCERENEW message.
 * Implement Force Renew Nonce Capability option, RFC6704
 * Support RECONFIGURE DHCPv6 messages.
 * Add support for DHCP auto configuration, RFC 2563.
 * Add support for the following RFCs
   + DHCP SLP Directory Agent, RFC2610
   + DHCP Name Service Search, RFC2937
   + DHCP PANA Authentication Agent, RFC5192
   + DHCP Lost Server, RFC5223
   + DHCP CAPWAP, RFC5417
   + DHCP Mobility Services, RFC5678
   + DHCP SIP UA, RFC6011
   + DHCP ANDSF, RFC6153
   + DHCP RDNSS Selection for MIF Nodes, RFC6731
   + DHCP TFTP Server Address, RFC5859
   + DHCP PXELINUX, RFC5071
   + DHCP Access Network Domain Name, RFC5986
   + DHCP Virtual Subnet Selection, RFC6607
   + DHCP Relay Agent Remote-ID, RFC4649
   + DHCP Relay Agent Subscriber-ID, RFC4580
   + DHCPv6 Relay-ID, RFC5460
   + DHCPv6 LIS Discovery, RFC5986
   + DHCPv6 SIP UA, RFC6011
   + DHCPv6 Network Boot, RFC5970
   + DHCPv6 Home Info Discovery in MIPv6, RFC6610
   + DHCPv6 RDNSS Selection for MIF Nodes, RFC6731
   + DHCPv6 Kerberos, RFC6784
   + DHCPv6 Relay-Triggered Reconfiguration, RFC6977
   + DHCPv6 SOL_MAX_RT, RFC7083
 * Open UDP sockets for *.*.*.*:bootpc and $ip_address:bootpc to avoid kernel ICMP unreachable messages
 * Moved global variables into context variables so dhcpcd is entirely thread safe.
   dhcpcd doens't use threads, but it can now be used in a pure threads (ie no process) environment.
 * Remove DEBUG_MEMORY guard and always free memory and resources. Remove all atexit(3) and exit(3) calls, instead exiting via the eloop.
 * Replace get_line with sscanf where applicable.
 * Remove custom set_cloexec and set_nonblock functions. Instead pass O_CLOEXEC or SOCK_CLOEXEC to open, socket, etc.
 * Don't use PATH_MAX - we already know the maximum length from the initial directory and IF_NAMESIZE.
 * Add a USE_SIGNALS define. If we're not using signals then we also create a control socket in the non MASTER case. We then use this to communicate instead of signals.
 * Fix arping moving to the next test if we find the IP address but do not have a profile for it. Thanks to David McGurty for the analysis.
 * Respect initial commandline arguments when rebooting via a signal.
@
text
@d10 1
a10 1
		/etc/wpa_supplicant/wpa_supplicant-"$interface".conf \
a11 2
		/etc/wpa_supplicant-"$interface".conf \
		/etc/wpa_supplicant.conf \
a20 16
wpa_supplcant_ctrldir() {
	local dir

	dir=$(key_get_value "[[:space:]]*ctrl_interface=" \
		"$wpa_supplicant_conf")
	dir=$(trim "$dir")
	case "$dir" in
	DIR=*)
		dir=${dir##DIR=}
		dir=${dir%%[[:space:]]GROUP=*}
		dir=$(trim "$dir")
		;;
	esac
	printf %s "$dir"
}

d23 1
a23 16
	local dir err errn

	# Pre flight checks
	if [ ! -s "$wpa_supplicant_conf" ]; then
		syslog warn \
			"$wpa_supplicant_conf does not exist"
		syslog warn "not interacting with wpa_supplicant(8)"
		return 1
	fi
	dir=$(wpa_supplcant_ctrldir)
	if [ -z "$dir" ]; then
		syslog warn \
			"ctrl_interface not defined in $wpa_supplicant_conf"
		syslog warn "not interacting with wpa_supplicant(8)"
		return 1
	fi
d25 1
a25 1
	wpa_cli -p "$dir" -i "$interface" status >/dev/null 2>&1 && return 0
d38 1
a38 1
	local dir err errn
d40 1
a40 3
	dir=$(wpa_supplcant_ctrldir)
	[ -z "$dir" ] && return 1
	if ! wpa_cli -p "$dir" -i "$interface" status >/dev/null 2>&1; then
d45 1
a45 1
	err=$(wpa_cli -p "$dir" -i "$interface" reconfigure 2>&1)
d56 1
a56 1
	local dir err errn
d58 1
a58 3
	dir=$(wpa_supplcant_ctrldir)
	[ -z "$dir" ] && return 1
	wpa_cli -p "$dir" -i "$interface" status >/dev/null 2>&1 || return 0
d68 1
d70 1
a70 1
if [ "$ifwireless" = "1" ] && \
@


1.1.1.4
log
@Import dhcpcd-6.3.1 with the following changes

  * all issuses reported by clang static analyser have been resolved.
@
text
@d23 1
a23 2
wpa_supplicant_ctrldir()
{
a42 3
	# If the carrier is up, don't bother checking anything
	[ "$ifcarrier" = "up" ] && return 0

d50 1
a50 1
	dir=$(wpa_supplicant_ctrldir)
d73 1
a73 1
	dir=$(wpa_supplicant_ctrldir)
d93 1
a93 1
	dir=$(wpa_supplicant_ctrldir)
@


1.1.1.4.6.1
log
@Pullup the import of dhcpcd-6.6.7, requested by roy in #207
@
text
@d1 1
a1 1
# $NetBSD: 10-wpa_supplicant,v 1.6 2014/11/07 20:51:03 roy Exp $
d64 1
a64 3
	driver=${wpa_supplicant_driver:+-D}$wpa_supplicant_driver
	err=$(wpa_supplicant -B -c"$wpa_supplicant_conf" -i"$interface" \
	    "$driver" 2>&1)
@


1.1.1.4.6.2
log
@Pull up following revision(s) (requested by roy in ticket #1621):

	external/bsd/dhcpcd/dist/compat/crypt/sha256.c  up to 1.1.1.1
	external/bsd/dhcpcd/dist/compat/crypt/md5.c     up to 1.1.1.1
	external/bsd/dhcpcd/dist/compat/crypt/md5.h     up to 1.1.1.2
	external/bsd/dhcpcd/dist/compat/crypt/sha256.h  up to 1.1.1.1
	external/bsd/dhcpcd/dist/compat/crypt/hmac.c    up to 1.1.1.1
	external/bsd/dhcpcd/dist/compat/crypt/hmac.h    up to 1.1.1.1
	external/bsd/dhcpcd/dist/compat/_strtoi.h       up to 1.1.1.1
	external/bsd/dhcpcd/dist/compat/arc4random.c    up to 1.1.1.1
	external/bsd/dhcpcd/dist/compat/arc4random.h    up to 1.1.1.1
	external/bsd/dhcpcd/dist/compat/arc4random_uniform.c up to 1.1.1.1
	external/bsd/dhcpcd/dist/compat/arc4random_uniform.h up to 1.1.1.1
	external/bsd/dhcpcd/dist/compat/bitops.h        up to 1.1.1.1
	external/bsd/dhcpcd/dist/compat/dprintf.c       up to 1.1.1.2
	external/bsd/dhcpcd/dist/compat/dprintf.h       up to 1.1.1.2
	external/bsd/dhcpcd/dist/compat/endian.h        up to 1.1.1.1
	external/bsd/dhcpcd/dist/compat/pidfile.c       up to 1.1.1.1
	external/bsd/dhcpcd/dist/compat/pidfile.h       up to 1.1.1.1
	external/bsd/dhcpcd/dist/compat/queue.h         up to 1.1.1.1
	external/bsd/dhcpcd/dist/compat/reallocarray.c  up to 1.1.1.1
	external/bsd/dhcpcd/dist/compat/reallocarray.h  up to 1.1.1.1
	external/bsd/dhcpcd/dist/compat/strtoi.c        up to 1.1.1.1
	external/bsd/dhcpcd/dist/compat/strtoi.h        up to 1.1.1.1
	external/bsd/dhcpcd/dist/compat/strtou.c        up to 1.1.1.1
	external/bsd/dhcpcd/dist/compat/strlcpy.c       up to 1.1.1.1
	external/bsd/dhcpcd/dist/compat/strlcpy.h       up to 1.1.1.1
	external/bsd/dhcpcd/dist/config-null.mk         up to 1.1.1.1
	external/bsd/dhcpcd/dist/configure              up to 1.1.1.8
	external/bsd/dhcpcd/dist/iconfig.mk             up to 1.1.1.1
	external/bsd/dhcpcd/dist/hooks/01-test          up to 1.1.1.2
	external/bsd/dhcpcd/dist/hooks/02-dump          up to 1.1.1.1
	external/bsd/dhcpcd/dist/hooks/10-wpa_supplicant up to 1.1.1.2
	external/bsd/dhcpcd/dist/hooks/15-timezone      up to 1.1.1.2
	external/bsd/dhcpcd/dist/hooks/20-resolv.conf   up to 1.1.1.2
	external/bsd/dhcpcd/dist/hooks/29-lookup-hostname up to 1.1.1.2
	external/bsd/dhcpcd/dist/hooks/30-hostname      up to 1.1.1.2
	external/bsd/dhcpcd/dist/hooks/50-dhcpcd-compat up to 1.1.1.1
	external/bsd/dhcpcd/dist/hooks/50-ntp.conf      up to 1.1.1.2
	external/bsd/dhcpcd/dist/hooks/50-yp.conf       up to 1.1.1.2
	external/bsd/dhcpcd/dist/hooks/50-ypbind.in     up to 1.1.1.2
	external/bsd/dhcpcd/dist/hooks/Makefile         up to 1.1.1.1
	external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.8.in up to 1.1.1.4
	external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.in up to 1.1.1.4
	external/bsd/dhcpcd/dist/src/GNUmakefile        up to 1.1.1.1
	external/bsd/dhcpcd/dist/src/Makefile           up to 1.1.1.4
	external/bsd/dhcpcd/dist/src/arp.c              up to 1.1.1.7
	external/bsd/dhcpcd/dist/src/arp.h              up to 1.1.1.4
	external/bsd/dhcpcd/dist/src/auth.c             up to 1.1.1.5
	external/bsd/dhcpcd/dist/src/auth.h             up to 1.1.1.3
	external/bsd/dhcpcd/dist/src/bpf.c              up to 1.7
	external/bsd/dhcpcd/dist/src/bpf.h              up to 1.1.1.4
	external/bsd/dhcpcd/dist/src/common.c           up to 1.1.1.5
	external/bsd/dhcpcd/dist/src/common.h           up to 1.1.1.4
	external/bsd/dhcpcd/dist/src/control.c          up to 1.1.1.3
	external/bsd/dhcpcd/dist/src/control.h          up to 1.1.1.2
	external/bsd/dhcpcd/dist/src/defs.h             up to 1.1.1.15
	external/bsd/dhcpcd/dist/src/dev.c              up to 1.1.1.3
	external/bsd/dhcpcd/dist/src/dev.h              up to 1.1.1.2
	external/bsd/dhcpcd/dist/src/dhcp-common.c      up to 1.1.1.4
	external/bsd/dhcpcd/dist/src/dhcp-common.h      up to 1.1.1.2
	external/bsd/dhcpcd/dist/src/dhcp.c             up to 1.11
	external/bsd/dhcpcd/dist/src/dhcp.h             up to 1.1.1.6
	external/bsd/dhcpcd/dist/src/dhcp6.c            up to 1.1.1.12
	external/bsd/dhcpcd/dist/src/dhcp6.h            up to 1.1.1.6
	external/bsd/dhcpcd/dist/src/dhcpcd-definitions-small.conf up to 1.1.1.2
	external/bsd/dhcpcd/dist/src/dhcpcd-definitions.conf up to 1.1.1.2
	external/bsd/dhcpcd/dist/src/dhcpcd-embedded.c.in up to 1.1.1.2
	external/bsd/dhcpcd/dist/src/dhcpcd-embedded.h.in up to 1.1.1.2
	external/bsd/dhcpcd/dist/src/dhcpcd.8.in        up to 1.1.1.10
	external/bsd/dhcpcd/dist/src/dhcpcd.c           up to 1.13
	external/bsd/dhcpcd/dist/src/dhcpcd.conf        up to 1.1.1.2
	external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in   up to 1.1.1.10
	external/bsd/dhcpcd/dist/src/dhcpcd.h           up to 1.1.1.5
	external/bsd/dhcpcd/dist/src/duid.c             up to 1.1.1.3
	external/bsd/dhcpcd/dist/src/duid.h             up to 1.1.1.1
	external/bsd/dhcpcd/dist/src/eloop.c            up to 1.1.1.5
	external/bsd/dhcpcd/dist/src/eloop.h            up to 1.1.1.3
	external/bsd/dhcpcd/dist/src/genembedc          up to 1.1.1.1
	external/bsd/dhcpcd/dist/src/genembedh          up to 1.1.1.1
	external/bsd/dhcpcd/dist/src/if-bsd.c           up to 1.1.1.8
	external/bsd/dhcpcd/dist/src/if-linux-wext.c    up to 1.1.1.2
	external/bsd/dhcpcd/dist/src/if-linux.c         up to 1.1.1.10
	external/bsd/dhcpcd/dist/src/if-options.c       up to 1.10
	external/bsd/dhcpcd/dist/src/if-options.h       up to 1.1.1.7
	external/bsd/dhcpcd/dist/src/if-sun.c           up to 1.1.1.4
	external/bsd/dhcpcd/dist/src/if.c               up to 1.1.1.8
	external/bsd/dhcpcd/dist/src/if.h               up to 1.1.1.5
	external/bsd/dhcpcd/dist/src/ipv4.c             up to 1.1.1.9
	external/bsd/dhcpcd/dist/src/ipv4.h             up to 1.1.1.4
	external/bsd/dhcpcd/dist/src/ipv4ll.c           up to 1.1.1.4
	external/bsd/dhcpcd/dist/src/ipv4ll.h           up to 1.1.1.4
	external/bsd/dhcpcd/dist/src/ipv6.c             up to 1.1.1.11
	external/bsd/dhcpcd/dist/src/ipv6.h             up to 1.1.1.7
	external/bsd/dhcpcd/dist/src/ipv6nd.c           up to 1.1.1.8
	external/bsd/dhcpcd/dist/src/ipv6nd.h           up to 1.1.1.6
	external/bsd/dhcpcd/dist/src/logerr.c           up to 1.1.1.2
	external/bsd/dhcpcd/dist/src/logerr.h           up to 1.1.1.3
	external/bsd/dhcpcd/dist/src/route.c            up to 1.1.1.8
	external/bsd/dhcpcd/dist/src/route.h            up to 1.1.1.4
	external/bsd/dhcpcd/dist/src/sa.c               up to 1.1.1.3
	external/bsd/dhcpcd/dist/src/sa.h               up to 1.1.1.2
	external/bsd/dhcpcd/dist/src/script.c           up to 1.1.1.4
	external/bsd/dhcpcd/dist/src/script.h           up to 1.1.1.2
	external/bsd/dhcpcd/dist/src/dev/Makefile       up to 1.1.1.1
	external/bsd/dhcpcd/dist/src/dev/udev.c         up to 1.1.1.2
	external/bsd/dhcpcd/dist/tests/crypt/.gitignore up to 1.1.1.1
	external/bsd/dhcpcd/dist/tests/crypt/GNUmakefile up to 1.1.1.1
	external/bsd/dhcpcd/dist/tests/crypt/Makefile   up to 1.1.1.2
	external/bsd/dhcpcd/dist/tests/crypt/README.md  up to 1.1.1.1
	external/bsd/dhcpcd/dist/tests/crypt/run-test.c up to 1.1.1.2
	external/bsd/dhcpcd/dist/tests/crypt/test.h     up to 1.1.1.2
	external/bsd/dhcpcd/dist/tests/crypt/test_hmac_md5.c up to 1.1.1.3
	external/bsd/dhcpcd/dist/tests/Makefile         up to 1.1.1.1
	external/bsd/dhcpcd/dist/tests/eloop-bench/.gitignore up to 1.1.1.1
	external/bsd/dhcpcd/dist/tests/eloop-bench/Makefile up to 1.1.1.2
	external/bsd/dhcpcd/dist/tests/eloop-bench/README.md up to 1.1.1.1
	external/bsd/dhcpcd/dist/tests/eloop-bench/eloop-bench.c up to 1.1.1.3
	external/bsd/dhcpcd/dist/.arcconfig             up to 1.1.1.1
	external/bsd/dhcpcd/dist/.gitignore             up to 1.4
	external/bsd/dhcpcd/dist/BUILDING.md            up to 1.1.1.2
	external/bsd/dhcpcd/dist/LICENSE                up to 1.1.1.2
	external/bsd/dhcpcd/dist/Makefile               up to 1.1.1.5
	external/bsd/dhcpcd/dist/Makefile.inc           up to 1.1.1.2
	external/bsd/dhcpcd/dist/README.md              up to 1.1.1.3
	external/bsd/dhcpcd/dist/bpf-filter.h           delete
	external/bsd/dhcpcd/dist/common.c               delete
	external/bsd/dhcpcd/dist/arp.c                  delete
	external/bsd/dhcpcd/dist/arp.h                  delete
	external/bsd/dhcpcd/dist/auth.c                 delete
	external/bsd/dhcpcd/dist/auth.h                 delete
	external/bsd/dhcpcd/dist/dhcpcd.c               delete
	external/bsd/dhcpcd/dist/control.c              delete
	external/bsd/dhcpcd/dist/common.h               delete
	external/bsd/dhcpcd/dist/config.h               delete
	external/bsd/dhcpcd/dist/dhcp-common.c          delete
	external/bsd/dhcpcd/dist/control.h              delete
	external/bsd/dhcpcd/dist/defs.h                 delete
	external/bsd/dhcpcd/dist/dev.h                  delete
	external/bsd/dhcpcd/dist/dhcpcd-definitions.conf delete
	external/bsd/dhcpcd/dist/dhcp-common.h          delete
	external/bsd/dhcpcd/dist/dhcp.c                 delete
	external/bsd/dhcpcd/dist/dhcp.h                 delete
	external/bsd/dhcpcd/dist/dhcp6.c                delete
	external/bsd/dhcpcd/dist/dhcp6.h                delete
	external/bsd/dhcpcd/dist/dhcpcd-run-hooks.8.in  delete
	external/bsd/dhcpcd/dist/dhcpcd-embedded.c      delete
	external/bsd/dhcpcd/dist/dhcpcd.8.in            delete
	external/bsd/dhcpcd/dist/dhcpcd-embedded.c.in   delete
	external/bsd/dhcpcd/dist/dhcpcd-embedded.h      delete
	external/bsd/dhcpcd/dist/dhcpcd-embedded.h.in   delete
	external/bsd/dhcpcd/dist/ipv4.c                 delete
	external/bsd/dhcpcd/dist/if.c                   delete
	external/bsd/dhcpcd/dist/dhcpcd-run-hooks.in    delete
	external/bsd/dhcpcd/dist/dhcpcd.h               delete
	external/bsd/dhcpcd/dist/dhcpcd.conf            delete
	external/bsd/dhcpcd/dist/dhcpcd.conf.5.in       delete
	external/bsd/dhcpcd/dist/duid.c                 delete
	external/bsd/dhcpcd/dist/duid.h                 delete
	external/bsd/dhcpcd/dist/eloop.c                delete
	external/bsd/dhcpcd/dist/eloop.h                delete
	external/bsd/dhcpcd/dist/if-bsd.c               delete
	external/bsd/dhcpcd/dist/if-options.c           delete
	external/bsd/dhcpcd/dist/if-options.h           delete
	external/bsd/dhcpcd/dist/if.h                   delete
	external/bsd/dhcpcd/dist/crypt/hmac_md5.c       delete
	external/bsd/dhcpcd/dist/crypt/crypt.h          delete
	external/bsd/dhcpcd/dist/ipv4.h                 delete
	external/bsd/dhcpcd/dist/ipv4ll.c               delete
	external/bsd/dhcpcd/dist/ipv6.c                 delete
	external/bsd/dhcpcd/dist/ipv4ll.h               delete
	external/bsd/dhcpcd/dist/ipv6.h                 delete
	external/bsd/dhcpcd/dist/ipv6nd.c               delete
	external/bsd/dhcpcd/dist/ipv6nd.h               delete
	external/bsd/dhcpcd/dist/script.c               delete
	external/bsd/dhcpcd/dist/script.h               delete
	external/bsd/dhcpcd/dist/dhcpcd-hooks/15-timezone delete
	external/bsd/dhcpcd/dist/dhcpcd-hooks/01-test   delete
	external/bsd/dhcpcd/dist/dhcpcd-hooks/02-dump   delete
	external/bsd/dhcpcd/dist/dhcpcd-hooks/10-mtu    delete
	external/bsd/dhcpcd/dist/dhcpcd-hooks/10-wpa_supplicant delete
	external/bsd/dhcpcd/dist/dhcpcd-hooks/20-resolv.conf delete
	external/bsd/dhcpcd/dist/dhcpcd-hooks/29-lookup-hostname delete
	external/bsd/dhcpcd/dist/dhcpcd-hooks/30-hostname delete
	external/bsd/dhcpcd/dist/dhcpcd-hooks/50-ntp.conf delete
	external/bsd/dhcpcd/dist/dhcpcd-hooks/50-ypbind delete
	usr.sbin/postinstall/postinstall: revision 1.211-1.213
	etc/rc.d/dhcpcd					upto 1.5
	doc/3RDPARTY					manual edit

Import dhcpcd-7.0.7.
Adjust postinstal and rc file.
@
text
@d1 1
a1 1
# $NetBSD: 10-wpa_supplicant,v 1.1.1.4.6.1 2014/12/29 16:18:05 martin Exp $
@


1.1.1.5
log
@Import dhcpcd-6.4.4 with the following changes:
  *  Many bounds checking fixes from Tobias Stoeckmann
  *  Improve error when the authentication token cannot be found
  *  close the IPv4 specific UDP socket when done sending
  *  Implemented a write queue to the control sockets
  *  Only send interfaces to control sockets when in a BOUND state
  *  Add a sample controlgroup directive to dhcpcd.conf to make setup easier
  *  Add variables if_oneup and if_ipwaited so hook scripts know the overall
     state of dhcpcd better
  *  Pass RC_SVCNAME from enviromment to hooks so that a service hook can
     know it's name (may not be dhcpcd)
  *  Document every variable set for dhcpcd-run-hooks(8)
  *  Allow SSIDs with non printable characters to be used in ssid selection
     in dhcpcd.conf
  *  Add an unprivileged control socket so that normal users can obtain
     dhcpcd running state
@
text
@d64 1
a64 3
	driver=${wpa_supplicant_driver:+-D}$wpa_supplicant_driver
	err=$(wpa_supplicant -B -c"$wpa_supplicant_conf" -i"$interface" \
	    "$driver" 2>&1)
@


1.1.1.6
log
@Import dhcpcd-6.6.1 with the following changes:
  *  Improve handling of the IPv6LL address at startup
  *  Support old Linux kernels where IFLA_AF_SPEC may not exist
  *  When stopping interfaces, skip past pseudo interfaces instead
     of finding the master as only the masters are sorted correctly

RCSIDs have been removed from the import and will be added afterwards
as patches as technically they are not part of the dhcpcd project directly.
Hopefully this will be future imports less painful.
@
text
@d1 1
a1 1

@


1.1.1.7
log
@Reimport dhcpcd-6.6.1 with correct hooks
@
text
@d1 2
@


1.1.1.4.4.1
log
@file 10-wpa_supplicant was added on branch yamt-pagecache on 2014-05-22 15:44:40 +0000
@
text
@d1 119
@


1.1.1.4.4.2
log
@sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs.  ("Protocol error: too many arguments")
@
text
@a0 119
# $NetBSD$

# Start, reconfigure and stop wpa_supplicant per wireless interface.
# This is needed because wpa_supplicant lacks hotplugging of any kind
# and the user should not be expected to have to wire it into their system
# if the base system doesn't do this itself.

if [ -z "$wpa_supplicant_conf" ]; then
	for x in \
		/etc/wpa_supplicant/wpa_supplicant-"$interface".conf \
		/etc/wpa_supplicant/wpa_supplicant.conf \
		/etc/wpa_supplicant-"$interface".conf \
		/etc/wpa_supplicant.conf \
	; do
		if [ -s "$x" ]; then
			wpa_supplicant_conf="$x"
			break
		fi
	done
fi
: ${wpa_supplicant_conf:=/etc/wpa_supplicant.conf}

wpa_supplicant_ctrldir()
{
	local dir

	dir=$(key_get_value "[[:space:]]*ctrl_interface=" \
		"$wpa_supplicant_conf")
	dir=$(trim "$dir")
	case "$dir" in
	DIR=*)
		dir=${dir##DIR=}
		dir=${dir%%[[:space:]]GROUP=*}
		dir=$(trim "$dir")
		;;
	esac
	printf %s "$dir"
}

wpa_supplicant_start()
{
	local dir err errn

	# If the carrier is up, don't bother checking anything
	[ "$ifcarrier" = "up" ] && return 0

	# Pre flight checks
	if [ ! -s "$wpa_supplicant_conf" ]; then
		syslog warn \
			"$wpa_supplicant_conf does not exist"
		syslog warn "not interacting with wpa_supplicant(8)"
		return 1
	fi
	dir=$(wpa_supplicant_ctrldir)
	if [ -z "$dir" ]; then
		syslog warn \
			"ctrl_interface not defined in $wpa_supplicant_conf"
		syslog warn "not interacting with wpa_supplicant(8)"
		return 1
	fi

	wpa_cli -p "$dir" -i "$interface" status >/dev/null 2>&1 && return 0
	syslog info "starting wpa_supplicant"
	err=$(wpa_supplicant -B -c"$wpa_supplicant_conf" -i"$interface" 2>&1)
	errn=$?
	if [ $errn != 0 ]; then
		syslog err "failed to start wpa_supplicant"
		syslog err "$err"
	fi
	return $errn
}

wpa_supplicant_reconfigure()
{
	local dir err errn

	dir=$(wpa_supplicant_ctrldir)
	[ -z "$dir" ] && return 1
	if ! wpa_cli -p "$dir" -i "$interface" status >/dev/null 2>&1; then
		wpa_supplicant_start
		return $?
	fi
	syslog info "reconfiguring wpa_supplicant"
	err=$(wpa_cli -p "$dir" -i "$interface" reconfigure 2>&1)
	errn=$?
	if [ $errn != 0 ]; then
		syslog err "failed to reconfigure wpa_supplicant"
		syslog err "$err"
	fi
	return $errn
}

wpa_supplicant_stop()
{
	local dir err errn

	dir=$(wpa_supplicant_ctrldir)
	[ -z "$dir" ] && return 1
	wpa_cli -p "$dir" -i "$interface" status >/dev/null 2>&1 || return 0
	syslog info "stopping wpa_supplicant"
	err=$(wpa_cli -i"$interface" terminate 2>&1)
	errn=$?
	if [ $errn != 0 ]; then
		syslog err "failed to start wpa_supplicant"
		syslog err "$err"
	fi
	return $errn
}

if [ "$ifwireless" = "1" ] && \
    type wpa_supplicant >/dev/null 2>&1 && \
    type wpa_cli >/dev/null 2>&1
then
	case "$reason" in
	PREINIT)	wpa_supplicant_start;;
	RECONFIGURE)	wpa_supplicant_reconfigure;;
	DEPARTED)	wpa_supplicant_stop;;
	esac
fi
@


1.1.1.1.2.1
log
@file 10-wpa_supplicant was added on branch tls-maxphys on 2013-06-23 06:26:31 +0000
@
text
@d1 68
@


1.1.1.1.2.2
log
@resync from head
@
text
@a0 68
# $NetBSD$

# Start, reconfigure and stop wpa_supplicant per wireless interface.
# This is needed because wpa_supplicant lacks hotplugging of any kind
# and the user should not be expected to have to wire it into their system
# if the base system doesn't do this itself.

: ${wpa_supplicant_conf:=/etc/wpa_supplicant.conf}

wpa_supplicant_start()
{
	local err errn

	wpa_cli -i "$interface" status >/dev/null 2>&1 && return 0
	syslog info "starting wpa_supplicant"
	err=$(wpa_supplicant -B -c"$wpa_supplicant_conf" -i"$interface" 2>&1)
	errn=$?
	if [ $errn != 0 ]; then
		syslog err "failed to start wpa_supplicant"
		syslog err "$err"
	fi
	return $errn
}

wpa_supplicant_reconfigure()
{
	local err errn

	if ! wpa_cli -i "$interface" status >/dev/null 2>&1; then
		wpa_supplicant_start
		return $?
	fi
	syslog info "reconfiguring wpa_supplicant"
	err=$(wpa_cli -i"$interface" reconfigure 2>&1)
	errn=$?
	if [ $errn != 0 ]; then
		syslog err "failed to reconfigure wpa_supplicant"
		syslog err "$err"
	fi
	return $errn
}

wpa_supplicant_stop()
{
	local err errn

	wpa_cli -i "$interface" status >/dev/null 2>&1 || return 0
	syslog info "stopping wpa_supplicant"
	err=$(wpa_cli -i"$interface" terminate 2>&1)
	errn=$?
	if [ $errn != 0 ]; then
		syslog err "failed to start wpa_supplicant"
		syslog err "$err"
	fi
	return $errn
}
	

if [ "$ifwireless" = "1" -a -s "$wpa_supplicant_conf" ] && \
    type wpa_supplicant >/dev/null 2>&1 && \
    type wpa_cli >/dev/null 2>&1
then
	case "$reason" in
	PREINIT)	wpa_supplicant_start;;
	RECONFIGURE)	wpa_supplicant_reconfigure;;
	DEPARTED)	wpa_supplicant_stop;;
	esac
fi
@


1.1.1.1.2.3
log
@Rebase to HEAD as of a few days ago.
@
text
@a7 13
if [ -z "$wpa_supplicant_conf" ]; then
	for x in \
		/etc/wpa_supplicant/wpa_supplicant-"$interface".conf \
		/etc/wpa_supplicant/wpa_supplicant.conf \
		/etc/wpa_supplicant-"$interface".conf \
		/etc/wpa_supplicant.conf \
	; do
		if [ -s "$x" ]; then
			wpa_supplicant_conf="$x"
			break
		fi
	done
fi
a9 17
wpa_supplicant_ctrldir()
{
	local dir

	dir=$(key_get_value "[[:space:]]*ctrl_interface=" \
		"$wpa_supplicant_conf")
	dir=$(trim "$dir")
	case "$dir" in
	DIR=*)
		dir=${dir##DIR=}
		dir=${dir%%[[:space:]]GROUP=*}
		dir=$(trim "$dir")
		;;
	esac
	printf %s "$dir"
}

d12 1
a12 19
	local dir err errn

	# If the carrier is up, don't bother checking anything
	[ "$ifcarrier" = "up" ] && return 0

	# Pre flight checks
	if [ ! -s "$wpa_supplicant_conf" ]; then
		syslog warn \
			"$wpa_supplicant_conf does not exist"
		syslog warn "not interacting with wpa_supplicant(8)"
		return 1
	fi
	dir=$(wpa_supplicant_ctrldir)
	if [ -z "$dir" ]; then
		syslog warn \
			"ctrl_interface not defined in $wpa_supplicant_conf"
		syslog warn "not interacting with wpa_supplicant(8)"
		return 1
	fi
d14 1
a14 1
	wpa_cli -p "$dir" -i "$interface" status >/dev/null 2>&1 && return 0
d27 1
a27 1
	local dir err errn
d29 1
a29 3
	dir=$(wpa_supplicant_ctrldir)
	[ -z "$dir" ] && return 1
	if ! wpa_cli -p "$dir" -i "$interface" status >/dev/null 2>&1; then
d34 1
a34 1
	err=$(wpa_cli -p "$dir" -i "$interface" reconfigure 2>&1)
d45 1
a45 1
	local dir err errn
d47 1
a47 3
	dir=$(wpa_supplicant_ctrldir)
	[ -z "$dir" ] && return 1
	wpa_cli -p "$dir" -i "$interface" status >/dev/null 2>&1 || return 0
d57 1
d59 1
a59 1
if [ "$ifwireless" = "1" ] && \
@
