From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.linux.dev
Cc: James Prestwood <prestwoj@gmail.com>
Subject: [RFC 1/4] knownnetworks: set ops on info in __network_info_init
Date: Wed, 13 Dec 2023 09:25:43 -0800 [thread overview]
Message-ID: <20231213172546.145998-2-prestwoj@gmail.com> (raw)
In-Reply-To: <20231213172546.145998-1-prestwoj@gmail.com>
This function was only used by hotspot as a backdoor to initializing
a network info object. For the hotspot case it has its own ops
structure which is set after calling.
DPP now will need a way to create/update a known network from a
receieved configuration but it only needs the default ops structure
from known networks. Set this automatically within this function.
This won't pose an issue to hotspot as it will just overwrite the
ops pointer to its own implementation.
---
src/knownnetworks.c | 32 +++++++++++++++++---------------
1 file changed, 17 insertions(+), 15 deletions(-)
diff --git a/src/knownnetworks.c b/src/knownnetworks.c
index e2d0d515..b8f13cbc 100644
--- a/src/knownnetworks.c
+++ b/src/knownnetworks.c
@@ -125,21 +125,6 @@ void __network_config_parse(const struct l_settings *settings,
}
}
-void __network_info_init(struct network_info *info,
- const char *ssid, enum security security,
- struct network_config *config)
-{
- if (ssid)
- strcpy(info->ssid, ssid);
-
- info->type = security;
-
- memcpy(&info->config, config, sizeof(struct network_config));
-
- if (info->config.is_hidden)
- num_known_hidden_networks++;
-}
-
static void network_info_free(void *data)
{
struct network_info *network = data;
@@ -815,6 +800,23 @@ void known_networks_add(struct network_info *network)
KNOWN_NETWORKS_EVENT_ADDED, network);
}
+void __network_info_init(struct network_info *info,
+ const char *ssid, enum security security,
+ struct network_config *config)
+{
+ if (ssid)
+ strcpy(info->ssid, ssid);
+
+ info->type = security;
+
+ memcpy(&info->config, config, sizeof(struct network_config));
+
+ if (info->config.is_hidden)
+ num_known_hidden_networks++;
+
+ info->ops = &known_network_ops;
+}
+
static void known_network_new(const char *ssid, enum security security,
struct network_config *config)
{
--
2.34.1
next prev parent reply other threads:[~2023-12-13 17:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-13 17:25 [RFC 0/4] Fix extra settings not being taken post-DPP James Prestwood
2023-12-13 17:25 ` James Prestwood [this message]
2023-12-13 17:25 ` [RFC 2/4] station: unify scan cancelation James Prestwood
2023-12-13 17:32 ` James Prestwood
2023-12-13 17:25 ` [RFC 3/4] dpp: fix non-scan connect path in DPP James Prestwood
2023-12-13 17:25 ` [RFC 4/4] auto-t: add a few more DPP tests for seen/known networks James Prestwood
2023-12-13 22:59 ` [RFC 0/4] Fix extra settings not being taken post-DPP 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=20231213172546.145998-2-prestwoj@gmail.com \
--to=prestwoj@gmail.com \
--cc=iwd@lists.linux.dev \
/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