Hooks
-----
Not all the hooks in dhcpcd-hooks are installed by default.
-By default we install 01-test, 10-mtu, 20-resolv.conf,
-29-lookup-hostname and 30-hostname.
+By default we install 01-test, 02-dump, 10-mtu, 10-wpa_supplicant,
+15-timezone, 20-resolv.conf, 29-lookup-hostname and 30-hostname.
The default dhcpcd.conf disables the lookup-hostname hook by default.
The configure program attempts to find hooks for systems you have installed.
To add more simply
--- /dev/null
+# Start 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
+
+ wpa_cli -i "$interface" status >/dev/null 2>&1 || return 0
+ 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
SCRIPTSDIR= ${LIBEXECDIR}/dhcpcd-hooks
SCRIPTS= 01-test 02-dump
-SCRIPTS+= 10-mtu 15-timezone 20-resolv.conf
+SCRIPTS+= 10-mtu 10-wpa_supplicant 15-timezone 20-resolv.conf
SCRIPTS+= 29-lookup-hostname 30-hostname
SCRIPTS+= ${HOOKSCRIPTS}
.It Dv CARRIER
dhcpcd has detected the carrier is up.
This is generally just a notification and no action need be taken.
-.It Dv DEPARTED
-The interface has been removed.
.It Dv INFORM | Dv INFORM6
dhcpcd informed a DHCP server about it's address and obtained other
configuration details.
.It Dv NAK
dhcpcd received a NAK from the DHCP server.
This should be treated as EXPIRE.
+.It Dv RECONFIGURE
+dhcpcd has been instructed to reconfigure an interface.
.It Dv NOCARRIER
dhcpcd lost the carrier.
The cable may have been unplugged or association to the wireless point lost.
Static configuration and DHCP INFORM is still allowed.
.It Dv STOP | Dv STOP6
dhcpcd stopped running on the interface.
+.It Dv DEPARTED
+The interface has been removed.
.It Dv DUMP
dhcpcd has been asked to dump the last lease for the interface.
.It Dv TEST
metric.
See options below for controlling which interfaces we allow and deny through
the use of patterns.
-.Ss Hooking into DHCP events
+.Ss Hooking into events
.Nm
runs
.Pa @SCRIPT@ ,
The default installation supplies the scripts
.Pa 01-test ,
.Pa 10-mtu ,
+.Pa 10-wpa_supplicant ,
+.Pa 15-timezone ,
.Pa 20-resolv.conf
and
.Pa 30-hostname .
int oldopts;
oldopts = ifp->options->options;
+ script_runreason(ifp, "RECONFIGURE");
configure_interface(ifp, argc, argv);
dhcp_reboot_newopts(ifp, oldopts);
dhcp6_reboot(ifp);