Skip to content

Commit bac7ca6

Browse files
author
Mika Leppänen
committed
Changed RADIUS MTU and small fixes
1 parent a9f8b75 commit bac7ca6

File tree

8 files changed

+19
-10
lines changed

8 files changed

+19
-10
lines changed

source/6LoWPAN/ws/ws_config.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,4 +273,11 @@ extern uint8_t DEVICE_MIN_SENS;
273273
#define RADIUS_CLIENT_RETRY_IMAX 30 // First retry maximum 3 seconds
274274
#define RADIUS_CLIENT_TIMER_EXPIRATIONS 3 // Number of retries is three
275275

276+
/*
277+
* EAP-TLS fragment length
278+
*
279+
* Configures both EAP-TLS and the RADIUS client (Framed-MTU on RFC 2864)
280+
*/
281+
#define EAP_TLS_FRAGMENT_LEN_VALUE 600 // EAP-TLS fragment length
282+
276283
#endif /* WS_CONFIG_H_ */

source/6LoWPAN/ws/ws_pae_controller.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1221,7 +1221,8 @@ int8_t ws_pae_controller_radius_address_set(int8_t interface_id, const uint8_t *
12211221
}
12221222

12231223
if (ws_pae_auth_radius_address_set(controller->interface_ptr, radius_cfg->radius_addr) < 0) {
1224-
return -1;
1224+
// If not set here since authenticator not created, then set on authenticator initialization
1225+
return 0;
12251226
}
12261227

12271228
return 0;

source/Security/kmp/kmp_socket_if.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ int8_t kmp_socket_if_register(kmp_service_t *service, uint8_t *instance_id, bool
9191
if (*instance_id == 0) {
9292
socket_if->instance_id = kmp_socket_if_instance_id++;
9393
if (socket_if->instance_id == 0) {
94-
socket_if->instance_id++;
94+
socket_if->instance_id = kmp_socket_if_instance_id++;
9595
}
9696
*instance_id = socket_if->instance_id;
9797
}

source/Security/protocols/eap_tls_sec_prot/eap_tls_sec_prot_lib.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,8 @@ static int8_t eap_tls_sec_prot_lib_ack_update(tls_data_t *tls)
201201
return false;
202202
}
203203

204-
if (tls->handled_len + TLS_FRAGMENT_LEN < tls->total_len) {
205-
tls->handled_len += TLS_FRAGMENT_LEN;
204+
if (tls->handled_len + EAP_TLS_FRAGMENT_LEN_VALUE < tls->total_len) {
205+
tls->handled_len += EAP_TLS_FRAGMENT_LEN_VALUE;
206206
return false;
207207
}
208208

@@ -236,8 +236,8 @@ static uint8_t *eap_tls_sec_prot_lib_fragment_write(uint8_t *data, uint16_t tota
236236
data_begin[0] = *flags;
237237
}
238238

239-
if (total_len - handled_len > TLS_FRAGMENT_LEN) {
240-
*message_len += TLS_FRAGMENT_LEN;
239+
if (total_len - handled_len > EAP_TLS_FRAGMENT_LEN_VALUE) {
240+
*message_len += EAP_TLS_FRAGMENT_LEN_VALUE;
241241

242242
if (handled_len == 0) {
243243
data_begin -= 4; // length

source/Security/protocols/eap_tls_sec_prot/eap_tls_sec_prot_lib.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ typedef struct {
5454
uint16_t handled_len; /**< Handled length of the data buffer (e.g. acked by other end) */
5555
} tls_data_t;
5656

57-
#define TLS_FRAGMENT_LEN 600 //EAP-TLS fragment length
5857
#define TLS_HEAD_LEN 5 //EAP-TLS flags and EAP-TLS length
5958

6059
extern const uint8_t eap_msg_trace[4][10];

source/Security/protocols/eap_tls_sec_prot/radius_eap_tls_sec_prot.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ static void radius_eap_tls_sec_prot_state_machine(sec_prot_t *prot)
495495

496496
// On timeout
497497
if (sec_prot_result_timeout_check(&data->common)) {
498-
// Do nothing for now
498+
// Do nothing (trickle timer not running, so should not happen)
499499
return;
500500
}
501501

source/Security/protocols/radius_sec_prot/avp_helper.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
// EUI-64 in ascii string: 00-11-..-77
4747
#define STATION_ID_LEN 16 + 7
4848

49-
// MTU value TBD
50-
#define FRAMED_MTU 1400
49+
// MTU value is set by EAP-TLS fragment length
50+
#define FRAMED_MTU EAP_TLS_FRAGMENT_LEN_VALUE
5151

5252
#define NAS_PORT 1
5353

source/Security/protocols/radius_sec_prot/radius_client_sec_prot.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,9 @@ static int8_t radius_client_sec_prot_receive(sec_prot_t *prot, void *pdu, uint16
508508
if (radius_client_sec_prot_ms_mppe_recv_key_pmk_decrypt(prot, recv_key,
509509
recv_key_len - AVP_FIXED_LEN, data->request_authenticator, data->new_pmk) >= 0) {
510510
data->new_pmk_set = true;
511+
#ifdef EXTRA_DEBUG_INFO
511512
tr_info("RADIUS PMK: %s %s", tr_array(data->new_pmk, 16), tr_array(data->new_pmk + 16, 16));
513+
#endif
512514
}
513515
}
514516
}

0 commit comments

Comments
 (0)