From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.01.org
Subject: [PATCH v2 09/12] eap: remove mtu argument from eap_init
Date: Fri, 11 Oct 2019 12:29:30 -0700 [thread overview]
Message-ID: <20191011192933.13550-9-prestwoj@gmail.com> (raw)
In-Reply-To: <20191011192933.13550-1-prestwoj@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2857 bytes --]
This was refactored to set the mtu via __eap_set_config rather than
passing the MTU into eap_init. This makes eap work in a similar fashion
as eapol (i.e. __eapol_set_config).
If __eap_set_config is not used, the MTU will be set to 1020, which is
the same as previously passing 0 to eap_init.
---
src/eap.c | 12 ++++++++----
src/eap.h | 4 +++-
src/main.c | 7 ++-----
3 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/src/eap.c b/src/eap.c
index f605f432..b0fa72cf 100644
--- a/src/eap.c
+++ b/src/eap.c
@@ -676,6 +676,12 @@ int eap_unregister_method(struct eap_method *method)
return -ENOENT;
}
+void __eap_set_config(struct l_settings *config)
+{
+ if (!l_settings_get_uint(config, "EAP", "mtu", &default_mtu))
+ default_mtu = 1400; /* on WiFi the real MTU is around 2304 */
+}
+
static void __eap_method_enable(struct eap_method_desc *start,
struct eap_method_desc *stop)
{
@@ -715,7 +721,7 @@ static void __eap_method_disable(struct eap_method_desc *start,
extern struct eap_method_desc __start___eap[];
extern struct eap_method_desc __stop___eap[];
-void eap_init(uint32_t mtu)
+void eap_init(void)
{
eap_methods = l_queue_new();
__eap_method_enable(__start___eap, __stop___eap);
@@ -725,10 +731,8 @@ void eap_init(uint32_t mtu)
* EAP is capable of functioning on lower layers that
* provide an EAP MTU size of 1020 octets or greater.
*/
- if (mtu == 0)
+ if (default_mtu == 0)
default_mtu = 1020;
- else
- default_mtu = mtu;
}
void eap_exit(void)
diff --git a/src/eap.h b/src/eap.h
index de939cdc..8f128304 100644
--- a/src/eap.h
+++ b/src/eap.h
@@ -93,5 +93,7 @@ const char *eap_get_identity(struct eap_state *eap);
void eap_rx_packet(struct eap_state *eap, const uint8_t *pkt, size_t len);
-void eap_init(uint32_t default_mtu);
+void __eap_set_config(struct l_settings *config);
+
+void eap_init(void);
void eap_exit(void);
diff --git a/src/main.c b/src/main.c
index af6f0f74..1ff8d5d8 100644
--- a/src/main.c
+++ b/src/main.c
@@ -367,7 +367,6 @@ int main(int argc, char *argv[])
struct l_dbus *dbus;
const char *config_dir;
char **config_dirs;
- uint32_t eap_mtu;
int i;
for (;;) {
@@ -465,9 +464,7 @@ int main(int argc, char *argv[])
l_strv_free(config_dirs);
__eapol_set_config(iwd_config);
-
- if (!l_settings_get_uint(iwd_config, "EAP", "mtu", &eap_mtu))
- eap_mtu = 1400; /* on WiFi the real MTU is around 2304 */
+ __eap_set_config(iwd_config);
exit_status = EXIT_FAILURE;
@@ -496,7 +493,7 @@ int main(int argc, char *argv[])
l_dbus_set_disconnect_handler(dbus, dbus_disconnected, NULL, NULL);
dbus_init(dbus);
- eap_init(eap_mtu);
+ eap_init();
exit_status = l_main_run_with_signal(signal_handler, NULL);
plugin_exit();
--
2.17.1
next prev parent reply other threads:[~2019-10-11 19:29 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-11 19:29 [PATCH v2 01/12] main: move module init into nl80211_appeared James Prestwood
2019-10-11 19:29 ` [PATCH v2 02/12] netdev: utilize IWD_MODULE James Prestwood
2019-10-11 19:29 ` [PATCH v2 03/12] eapol: " James Prestwood
2019-10-11 19:29 ` [PATCH v2 04/12] anqp: " James Prestwood
2019-10-11 19:29 ` [PATCH v2 05/12] manager: remove white/black list from argument James Prestwood
2019-10-11 19:29 ` [PATCH v2 06/12] manager: utilize IWD_MODULE James Prestwood
2019-10-11 19:29 ` [PATCH v2 07/12] wiphy: remove white/blacklist from wiphy_init James Prestwood
2019-10-11 19:29 ` [PATCH v2 08/12] wiphy: utilize IWD_MODULE James Prestwood
2019-10-11 19:29 ` James Prestwood [this message]
2019-10-11 19:29 ` [PATCH v2 10/12] wired: update with new eap_init James Prestwood
2019-10-11 19:29 ` [PATCH v2 11/12] unit: update wsc/eapol " James Prestwood
2019-10-11 19:29 ` [PATCH v2 12/12] eap: utilize IWD_MODULE James Prestwood
2019-10-11 20:49 ` [PATCH v2 01/12] main: move module init into nl80211_appeared 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=20191011192933.13550-9-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox