[arch-projects] [netctl][PATCH] Reach network.target before communicating

Jouke Witteveen j.witteveen at gmail.com
Wed Aug 11 16:08:57 UTC 2021


Let the netctl profile service yield at the last moment before any
communication on the interface takes place. That way, we catch as many
problems as possible without suffering unpredictable delays.
This means network.target is reached earlier for wireless connections.
---
 src/lib/connections/mobile_ppp | 3 +--
 src/lib/connections/pppoe      | 2 +-
 src/lib/connections/wireless   | 1 +
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/lib/connections/mobile_ppp b/src/lib/connections/mobile_ppp
index 9e07ef9..8ad7a15 100644
--- a/src/lib/connections/mobile_ppp
+++ b/src/lib/connections/mobile_ppp
@@ -19,8 +19,6 @@ mobile_ppp_up() {
         rf_enable "$Interface" "$RFKill" || return 1
     fi
 
-    network_ready
-
     mkdir -p "$options_dir"
     if [[ -z $ChatScript ]]; then
         ChatScript="$options_dir/modem.chat"
@@ -83,6 +81,7 @@ connect $(quote_word "/usr/sbin/chat -v -t15 -f $(quote_word "$ChatScript")")
 ${OptionsFile:+file $(quote_word "$OptionsFile")}
 EOF
 
+    network_ready
     if ! $PPPD file "$options_dir/options"; then
         rm -r "$options_dir"
         report_error "Could not establish a ppp connection for profile '$Profile'."
diff --git a/src/lib/connections/pppoe b/src/lib/connections/pppoe
index 35bccf7..aab6168 100644
--- a/src/lib/connections/pppoe
+++ b/src/lib/connections/pppoe
@@ -18,7 +18,6 @@ pppoe_up() {
         report_error "Failed to bring interface '$Interface' up"
         return 1
     fi
-    network_ready
 
     mkdir -p "$(dirname "$options")"
     cat >> "$options" << EOF
@@ -48,6 +47,7 @@ password $(quote_word "$Password")
 ${OptionsFile:+file $(quote_word "$OptionsFile")}
 EOF
 
+    network_ready
     if ! $PPPD file "$options"; then
         rm "$options"
         rmdir "$(dirname "$options")"
diff --git a/src/lib/connections/wireless b/src/lib/connections/wireless
index aeec060..5444baa 100644
--- a/src/lib/connections/wireless
+++ b/src/lib/connections/wireless
@@ -49,6 +49,7 @@ wireless_up() {
         return 1
     fi
 
+    network_ready
     # Bring interface up after starting wpa_supplicant
     # This is important since cards such as iwl3945 do not support
     # mode switching when they are already up.
-- 
2.32.0



More information about the arch-projects mailing list