[arch-projects] [netcfg] [PATCH 1/2] auto-wireless: Always call dhcpcd with -K

Thomas Bächler thomas at archlinux.org
Tue Mar 27 05:29:29 EDT 2012


wpa_actiond watches the wireless link and kills dhcpcd when appropriate.
When the network goes down shortly (less than 30 seconds), then dhcpcd
still removes the IP and re-acquires the lease. This is unnecessary, and
breaks connectivity for a few seconds more than needed:

00 dhcpcd[1181]: wlan0: carrier lost
00 wpa_actiond[832]: Interface 'wlan0' lost connection to network 'XXXX'
04 dhcpcd[1181]: wlan0: carrier acquired
04 wpa_actiond[832]: Interface 'wlan0' reestablished connection to network 'XXXX'
04 dhcpcd[1181]: wlan0: rebinding lease of 11.22.33.44
04 dhcpcd[1181]: wlan0: acknowledged 11.22.33.44 from 11.22.33.33
04 dhcpcd[1181]: wlan0: checking for 11.22.33.44
09 dhcpcd[1181]: wlan0: leased 11.22.33.44 for 1800 seconds

Here, the wireless link was reestablished after 4 seconds, but the
connection was usable after 9 seconds.
---
 scripts/netcfg-wpa_actiond-action |    4 ++--
 src/connections/ethernet          |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/scripts/netcfg-wpa_actiond-action b/scripts/netcfg-wpa_actiond-action
index 3547fef..71ffcf7 100755
--- a/scripts/netcfg-wpa_actiond-action
+++ b/scripts/netcfg-wpa_actiond-action
@@ -11,10 +11,10 @@ action="$4"
 case $action in
     CONNECT)
         if [[ -z $profile ]]; then
-            dhcpcd "$interface"
+            dhcpcd -K "$interface"
             exit $?
         fi
-        if ! $CONN_DIR/ethernet up "$profile"; then
+        if ! DHCPCD_INTERNAL_OPTIONS="-K" $CONN_DIR/ethernet up "$profile"; then
             exit 1 # what to do if fail?
         fi
 
diff --git a/src/connections/ethernet b/src/connections/ethernet
index 3e4a992..b843c64 100644
--- a/src/connections/ethernet
+++ b/src/connections/ethernet
@@ -84,7 +84,7 @@ ethernet_up() {
             [[ -n "$DNS" ]] && DHCP_OPTIONS="-C resolv.conf $DHCP_OPTIONS"
             # Start dhcpcd
             report_debug ethernet_up dhcpcd -qL -t "${DHCP_TIMEOUT:-10}" $DHCP_OPTIONS "$INTERFACE"
-            dhcpcd -qL -t "${DHCP_TIMEOUT:-10}" $DHCP_OPTIONS "$INTERFACE" 2>&1 | report_debug "$(cat)"
+            dhcpcd -qL -t "${DHCP_TIMEOUT:-10}" $DHCPCD_INTERNAL_OPTIONS $DHCP_OPTIONS "$INTERFACE" 2>&1 | report_debug "$(cat)"
             if [[ "$PIPESTATUS" -ne 0 ]]; then
                 report_fail "DHCP IP lease attempt failed."
                 stop_80211x
-- 
1.7.9.4



More information about the arch-projects mailing list