Wireless Daemon for Linux
 help / color / mirror / Atom feed
From: Tim Kourt <tim.a.kourt@linux.intel.com>
To: iwd@lists.01.org
Subject: [PATCH v2 1/3] station: Move 'connected' logic out of enter state func
Date: Wed, 09 Oct 2019 14:53:31 -0700	[thread overview]
Message-ID: <20191009215333.14547-1-tim.a.kourt@linux.intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2920 bytes --]

Previously, station state 'connected' used to identify an interface associated
with AP. With the introduction of netconfig, an interface is assumed to be
connected after the IP addresses have been assigned to it. If netconfig is
disabled, the behavior remains unchanged.
---
 src/station.c | 41 +++++++++++++++++------------------------
 1 file changed, 17 insertions(+), 24 deletions(-)

diff --git a/src/station.c b/src/station.c
index 72393d51..af209ebb 100644
--- a/src/station.c
+++ b/src/station.c
@@ -1158,26 +1158,9 @@ static void station_enter_state(struct station *station,
 				IWD_NETWORK_INTERFACE, "Connected");
 		/* fall through */
 	case STATION_STATE_DISCONNECTED:
-		periodic_scan_stop(station);
-
-		break;
 	case STATION_STATE_CONNECTED:
 		periodic_scan_stop(station);
 
-		if (!station->netconfig)
-			break;
-
-		if (station->state == STATION_STATE_ROAMING) {
-			netconfig_reconfigure(station->netconfig);
-
-			break;
-		}
-
-		netconfig_configure(station->netconfig,
-					network_get_settings(
-						station->connected_network),
-					netdev_get_address(
-							station->netdev));
 		break;
 	case STATION_STATE_DISCONNECTING:
 	case STATION_STATE_ROAMING:
@@ -1302,6 +1285,11 @@ static void station_roamed(struct station *station)
 	station->signal_low = false;
 	station->roam_min_time.tv_sec = 0;
 	station->roam_no_orig_ap = false;
+
+	if (station->netconfig)
+		netconfig_reconfigure(station->netconfig);
+
+	station_enter_state(station, STATION_STATE_CONNECTED);
 }
 
 static void station_roam_failed(struct station *station)
@@ -1338,10 +1326,9 @@ static void station_reassociate_cb(struct netdev *netdev,
 	if (station->state != STATION_STATE_ROAMING)
 		return;
 
-	if (result == NETDEV_RESULT_OK) {
+	if (result == NETDEV_RESULT_OK)
 		station_roamed(station);
-		station_enter_state(station, STATION_STATE_CONNECTED);
-	} else
+	else
 		station_roam_failed(station);
 }
 
@@ -1357,10 +1344,9 @@ static void station_fast_transition_cb(struct netdev *netdev,
 	if (station->state != STATION_STATE_ROAMING)
 		return;
 
-	if (result == NETDEV_RESULT_OK) {
+	if (result == NETDEV_RESULT_OK)
 		station_roamed(station);
-		station_enter_state(station, STATION_STATE_CONNECTED);
-	} else
+	else
 		station_roam_failed(station);
 }
 
@@ -2280,7 +2266,14 @@ static void station_connect_cb(struct netdev *netdev, enum netdev_result result,
 	}
 
 	network_connected(station->connected_network);
-	station_enter_state(station, STATION_STATE_CONNECTED);
+
+	if (station->netconfig)
+		netconfig_configure(station->netconfig,
+					network_get_settings(
+						station->connected_network),
+					netdev_get_address(station->netdev));
+	else
+		station_enter_state(station, STATION_STATE_CONNECTED);
 }
 
 int __station_connect_network(struct station *station, struct network *network,
-- 
2.13.6

             reply	other threads:[~2019-10-09 21:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-09 21:53 Tim Kourt [this message]
2019-10-09 21:53 ` [PATCH v2 2/3] netconfig: Add netconfig event notifier Tim Kourt
2019-10-09 22:52   ` Denis Kenzior
2019-10-09 21:53 ` [PATCH v2 3/3] station: Subscribe to " Tim Kourt
2019-10-09 22:06 ` [PATCH v2 1/3] station: Move 'connected' logic out of enter state func Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191009215333.14547-1-tim.a.kourt@linux.intel.com \
    --to=tim.a.kourt@linux.intel.com \
    --cc=iwd@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox