All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.01.org
Subject: [PATCH 5/6] network: use erp_cache_check_identity
Date: Tue, 03 Aug 2021 10:27:58 -0700	[thread overview]
Message-ID: <20210803172759.123297-5-prestwoj@gmail.com> (raw)
In-Reply-To: <20210803172759.123297-1-prestwoj@gmail.com>

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

This will both check, and remove an invalidated entry if needed.
---
 src/network.c | 21 +--------------------
 1 file changed, 1 insertion(+), 20 deletions(-)

diff --git a/src/network.c b/src/network.c
index b78a7cbf..ec52e2bd 100644
--- a/src/network.c
+++ b/src/network.c
@@ -1058,10 +1058,8 @@ static bool match_bss(const void *a, const void *b)
 
 bool network_has_erp_identity(struct network *network)
 {
-	struct erp_cache_entry *cache;
 	struct l_settings *settings;
 	char *check_id;
-	const char *identity;
 	bool ret;
 
 	settings = network_get_settings(network);
@@ -1072,26 +1070,9 @@ bool network_has_erp_identity(struct network *network)
 	if (!check_id)
 		return false;
 
-	cache = erp_cache_get(network_get_ssid(network));
-	if (!cache) {
-		l_free(check_id);
-		return false;
-	}
-
-	identity = erp_cache_entry_get_identity(cache);
-
-	ret = strcmp(check_id, identity) == 0;
+	ret = erp_cache_check_identity(network->ssid, check_id);
 
 	l_free(check_id);
-	erp_cache_put(cache);
-
-	/*
-	 * The settings file must have change out from under us. In this
-	 * case we want to remove the ERP entry because it is no longer
-	 * valid.
-	 */
-	if (!ret)
-		erp_cache_remove(identity);
 
 	return ret;
 }
-- 
2.31.1

  parent reply	other threads:[~2021-08-03 17:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-03 17:27 [PATCH 1/6] fils: isolate ERP cache into fils.c James Prestwood
2021-08-03 17:27 ` [PATCH 2/6] station: don't set ERP cache to handshake James Prestwood
2021-08-03 17:27 ` [PATCH 3/6] handshake: remove ERP cache pointer James Prestwood
2021-08-03 17:27 ` [PATCH 4/6] erp: add erp_cache_check_identity James Prestwood
2021-08-03 17:27 ` James Prestwood [this message]
2021-08-03 17:27 ` [PATCH 6/6] erp: refactor to eliminate references/put/remove James Prestwood

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=20210803172759.123297-5-prestwoj@gmail.com \
    --to=prestwoj@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.