3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-21 03:32:42 +01:00

eap: Load MTU settings from iwd.conf

This commit is contained in:
Denis Kenzior 2016-11-15 16:44:07 -06:00
parent ec93454e65
commit d03f23200a
4 changed files with 21 additions and 7 deletions

View File

@ -31,6 +31,7 @@
#include "eap.h"
static uint32_t default_mtu;
struct l_queue *eap_methods;
struct eap_state {
@ -58,7 +59,7 @@ struct eap_state *eap_new(eap_tx_packet_func_t tx_packet,
eap = l_new(struct eap_state, 1);
eap->last_id = -1;
eap->mtu = 1024;
eap->mtu = default_mtu;
eap->tx_packet = tx_packet;
eap->complete = complete;
@ -504,10 +505,20 @@ 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(void)
void eap_init(uint32_t mtu)
{
eap_methods = l_queue_new();
__eap_method_enable(__start___eap, __stop___eap);
/*
* RFC 3748, Section 3.1, [4], "Minimum MTU":
* EAP is capable of functioning on lower layers that
* provide an EAP MTU size of 1020 octets or greater.
*/
if (mtu == 0)
default_mtu = 1020;
else
default_mtu = mtu;
}
void eap_exit(void)

View File

@ -59,7 +59,7 @@ size_t eap_get_mtu(struct eap_state *eap);
void eap_rx_packet(struct eap_state *eap, const uint8_t *pkt, size_t len);
void eap_init(void);
void eap_init(uint32_t default_mtu);
void eap_exit(void);
/* EAP method API */

View File

@ -1642,8 +1642,6 @@ bool eapol_init()
{
state_machines = l_queue_new();
eap_init();
return true;
}
@ -1654,7 +1652,5 @@ bool eapol_exit()
l_queue_destroy(state_machines, eapol_sm_destroy);
eap_exit();
return true;
}

View File

@ -37,6 +37,7 @@
#include "src/wiphy.h"
#include "src/dbus.h"
#include "src/network.h"
#include "src/eap.h"
#include "src/eapol.h"
#include "src/scan.h"
#include "src/wsc.h"
@ -145,6 +146,7 @@ int main(int argc, char *argv[])
struct l_genl *genl;
struct l_genl_family *nl80211;
char *config_path;
uint32_t eap_mtu;
for (;;) {
int opt;
@ -244,6 +246,10 @@ int main(int argc, char *argv[])
l_genl_family_set_watches(nl80211, nl80211_appeared, nl80211_vanished,
nl80211, NULL);
if (!l_settings_get_uint(iwd_config, "EAP", "mtu", &eap_mtu))
eap_mtu = 1400; /* on WiFi the real MTU is around 2304 */
eap_init(eap_mtu);
eapol_init();
network_init();
known_networks_init();
@ -256,6 +262,7 @@ int main(int argc, char *argv[])
known_networks_exit();
network_exit();
eapol_exit();
eap_exit();
l_genl_family_unref(nl80211);