void-packages/srcpkgs/dhcpcd/patches/wpa-hook-stop.patch
Juan RP dcd645ef90 dhcpcd: send STOPPED reason to hooks if iface is not up and down.
- Process STOPPED reason in the wpa_supplicant hook to stop it when
the interface goes down.

This has been suggested by Roy Marples (dhcpcd author) in private email.
a final review this seems to DTRT.
2014-11-28 12:45:18 +01:00

46 lines
1.2 KiB
Diff

--- dhcpcd-run-hooks.in.orig 2014-11-26 16:34:35.000000000 +0100
+++ dhcpcd-run-hooks.in 2014-11-28 11:53:13.712853795 +0100
@@ -2,13 +2,20 @@
# dhcpcd client configuration script
# Handy variables and functions for our hooks to use
+: ${if_up:=false}
+: ${if_down:=false}
+: ${syslog_debug:=false}
+
case "$reason" in
ROUTERADVERT)
ifsuffix=":ra";;
INFORM6|BOUND6|RENEW6|REBIND6|REBOOT6|EXPIRE6|RELEASE6|STOP6)
ifsuffix=":dhcp6";;
- STOPPED) # This reason should never be processed
- exit 0;;
+ STOPPED) # Only process this reason if iface is down.
+ if [ "$if_up" != "false" -o "$if_down" = "false" ]; then
+ exit 0
+ fi
+ ;;
*)
ifsuffix=;;
esac
@@ -22,10 +29,6 @@ signature_end="$signature_base_end $from
state_dir=@RUNDIR@/dhcpcd
_detected_init=false
-: ${if_up:=false}
-: ${if_down:=false}
-: ${syslog_debug:=false}
-
# Ensure that all arguments are unique
uniqify()
{
--- dhcpcd-hooks/10-wpa_supplicant.orig 2014-11-26 16:34:35.000000000 +0100
+++ dhcpcd-hooks/10-wpa_supplicant 2014-11-28 11:53:48.929217243 +0100
@@ -114,6 +114,6 @@ then
case "$reason" in
PREINIT) wpa_supplicant_start;;
RECONFIGURE) wpa_supplicant_reconfigure;;
- DEPARTED) wpa_supplicant_stop;;
+ DEPARTED|STOPPED) wpa_supplicant_stop;;
esac
fi