Skip to content

Commit 8a8b6ef

Browse files
author
Mika Leppänen
committed
Added configuration flags for supplicant and authenticator PAEs and EAPOL relay
If PAE supplicant flag is not defined, supplicant bootstrap continues without initiating EAPOL (returns always success)
1 parent 3868ff1 commit 8a8b6ef

File tree

10 files changed

+56
-4
lines changed

10 files changed

+56
-4
lines changed

source/6LoWPAN/ws/ws_eapol_auth_relay.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@
3535
#include "6LoWPAN/ws/ws_eapol_relay.h"
3636
#include "6LoWPAN/ws/ws_eapol_auth_relay.h"
3737
#include "common_functions.h"
38+
3839
#ifdef HAVE_WS
40+
#ifdef HAVE_PAE_AUTH
3941

4042
#define TRACE_GROUP "wspsu"
4143

@@ -44,6 +46,7 @@ static int8_t ws_eapol_auth_relay_eapol_pdu_receive(const uint8_t *eui_64, const
4446
static int8_t ws_eapol_auth_relay_socket_pdu_receive(const ns_address_t *src_addr, void *data, uint16_t len);
4547
static int8_t ws_eapol_auth_relay_send_to_kmp(const uint8_t *eui_64, const uint8_t *ip_addr, uint16_t port, const void *data, uint16_t data_len);
4648

49+
4750
int8_t ws_eapol_auth_relay_init(protocol_interface_info_entry_t *interface_ptr)
4851
{
4952
ws_eapol_relay_init(interface_ptr);
@@ -156,4 +159,5 @@ static int8_t ws_eapol_auth_relay_send_to_kmp(const uint8_t *eui_64, const uint8
156159
return -1;
157160
}
158161

162+
#endif /* HAVE_PAE_AUTH */
159163
#endif /* HAVE_WS */

source/6LoWPAN/ws/ws_eapol_auth_relay.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,16 @@
1818
#ifndef WS_EAPOL_AUTH_RELAY_H_
1919
#define WS_EAPOL_AUTH_RELAY_H_
2020

21+
#ifdef HAVE_PAE_AUTH
22+
2123
int8_t ws_eapol_auth_relay_init(protocol_interface_info_entry_t *interface_ptr);
2224
int8_t ws_eapol_auth_relay_start(void);
2325

26+
#else
27+
28+
#define ws_eapol_auth_relay_init(interface_ptr)
29+
#define ws_eapol_auth_relay_start()
30+
31+
#endif
32+
2433
#endif /* WS_EAPOL_AUTH_RELAY_H_ */

source/6LoWPAN/ws/ws_eapol_supp_relay.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include "6LoWPAN/ws/ws_eapol_supp_relay.h"
3636

3737
#ifdef HAVE_WS
38+
#ifdef HAVE_EAPOL_RELAY
3839

3940
#define TRACE_GROUP "wspsu"
4041

@@ -97,5 +98,6 @@ static int8_t ws_eapol_supp_relay_socket_pdu_receive(const ns_address_t *src_add
9798

9899
}
99100

101+
#endif /* HAVE_EAPOL_RELAY */
100102
#endif /* HAVE_WS */
101103

source/6LoWPAN/ws/ws_eapol_supp_relay.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,16 @@
1818
#ifndef WS_EAPOL_SUPP_RELAY_H_
1919
#define WS_EAPOL_SUPP_RELAY_H_
2020

21+
#ifdef HAVE_EAPOL_RELAY
22+
2123
int8_t ws_eapol_supp_relay_init(protocol_interface_info_entry_t *interface_ptr);
2224
int8_t ws_eapol_supp_relay_start(uint8_t *br_addr);
2325

26+
#else
27+
28+
#define ws_eapol_supp_relay_init(interface_ptr);
29+
#define ws_eapol_supp_relay_start(br_addr);
30+
31+
#endif
32+
2433
#endif /* WS_EAPOL_SUPP_RELAY_H_ */

source/6LoWPAN/ws/ws_pae_auth.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include "6LoWPAN/ws/ws_pae_lib.h"
4141

4242
#ifdef HAVE_WS
43+
#ifdef HAVE_PAE_AUTH
4344

4445
#define TRACE_GROUP "wspsu"
4546

@@ -380,5 +381,6 @@ static void ws_pae_auth_kmp_api_finished(kmp_api_t *kmp)
380381
ws_pae_lib_kmp_list_delete(&supp_entry->kmp_list, kmp);
381382
}
382383

384+
#endif /* HAVE_PAE_AUTH */
383385
#endif /* HAVE_WS */
384386

source/6LoWPAN/ws/ws_pae_auth.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@
1818
#ifndef WS_PAE_AUTH_H_
1919
#define WS_PAE_AUTH_H_
2020

21+
#ifdef HAVE_PAE_AUTH
22+
2123
int8_t ws_pae_auth_init(protocol_interface_info_entry_t *interface_ptr);
2224

25+
#else
26+
27+
#define ws_pae_auth_init(interface_ptr)
28+
29+
#endif
30+
2331
#endif /* WS_PAE_AUTH_H_ */

source/6LoWPAN/ws/ws_pae_controller.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ void ws_pae_controller_supplicant_authenticate(void)
5050

5151
ws_pae_supp_init(controller_data->interface_ptr);
5252
ws_pae_supp_cb_register(ws_pae_controller_supp_auth_completed);
53-
ws_pae_supp_authenticate(controller_data->target_eui_64);
53+
if (ws_pae_supp_authenticate(controller_data->target_eui_64) > 0) {
54+
// Already authenticated
55+
ws_pae_controller_supp_auth_completed(true);
56+
}
5457
}
5558

5659
void ws_pae_controller_authenticator_start(void)

source/6LoWPAN/ws/ws_pae_supp.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#include "Security/kmp/kmp_eapol_pdu_if.h"
4646

4747
#ifdef HAVE_WS
48+
#ifdef HAVE_PAE_SUPP
4849

4950
#define TRACE_GROUP "wspsu"
5051

@@ -93,7 +94,7 @@ static const trickle_params_t auth_trickle_params = {
9394
.TimerExpirations = 3 //TRICKLE_EXPIRATIONS_INFINITE
9495
};
9596

96-
void ws_pae_supp_authenticate(uint8_t *dest_eui_64)
97+
int8_t ws_pae_supp_authenticate(uint8_t *dest_eui_64)
9798
{
9899
// Stores target
99100
kmp_address_delete(supp_data->entry.addr);
@@ -114,6 +115,8 @@ void ws_pae_supp_authenticate(uint8_t *dest_eui_64)
114115
supp_data->auth_requested = true;
115116

116117
tr_debug("PAE active");
118+
119+
return 0;
117120
}
118121

119122
void ws_pae_supp_authenticate_response(bool success)
@@ -465,5 +468,6 @@ static void ws_pae_supp_kmp_api_finished(kmp_api_t *kmp)
465468
ws_pae_lib_kmp_list_delete(&supp_data->entry.kmp_list, kmp);
466469
}
467470

471+
#endif /* HAVE_PAE_SUPP */
468472
#endif /* HAVE_WS */
469473

source/6LoWPAN/ws/ws_pae_supp.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,18 @@
2020

2121
typedef void ws_pae_supp_auth_completed(bool success);
2222

23-
void ws_pae_supp_authenticate(uint8_t *dest_eui_64);
23+
#ifdef HAVE_PAE_SUPP
2424

2525
int8_t ws_pae_supp_init(protocol_interface_info_entry_t *interface_ptr);
26-
26+
int8_t ws_pae_supp_authenticate(uint8_t *dest_eui_64);
2727
void ws_pae_supp_cb_register(ws_pae_supp_auth_completed *completed_cb);
2828

29+
#else
30+
31+
#define ws_pae_supp_init(interface_ptr)
32+
#define ws_pae_supp_authenticate(dest_eui_64) 1
33+
#define ws_pae_supp_cb_register(completed_cb)
34+
35+
#endif
36+
2937
#endif /* WS_PAE_SUPP_H_ */

source/configs/cfg_generic.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,6 @@
3232
#define THREAD_THCI_SUPPORT
3333
#define HAVE_WS
3434
#define MLE_TEST
35+
//#define HAVE_PAE_SUPP
36+
//#define HAVE_PAE_AUTH
37+
//#define HAVE_EAPOL_RELAY

0 commit comments

Comments
 (0)