Skip to content

Commit c0e8cae

Browse files
author
Jarkko Paso
committed
Merge branch 'koli' into IOTTHD-2475
* koli: Count the amount of configuration solicits
2 parents c8f5c8d + 0ec37a6 commit c0e8cae

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

source/6LoWPAN/ws/ws_bootstrap.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1102,6 +1102,7 @@ static void ws_bootstrap_start_configuration_learn(protocol_interface_info_entry
11021102
// Clear all temporary information
11031103
ws_bootstrap_ip_stack_reset(cur);
11041104

1105+
cur->ws_info->pas_requests = 0;
11051106
// Reset advertisement solicit trickle to start discovering network
11061107
trickle_start(&cur->ws_info->trickle_pan_config_solicit, &trickle_params_pan_discovery);
11071108
trickle_inconsistent_heard(&cur->ws_info->trickle_pan_config_solicit, &trickle_params_pan_discovery);
@@ -1334,7 +1335,6 @@ static void ws_bootstrap_event_handler(arm_event_s *event)
13341335
ws_bootstrap_ip_stack_activate(cur);
13351336
ws_bootstrap_rpl_activate(cur);
13361337
ws_bootstrap_network_start(cur);
1337-
ws_bootstrap_advertise_start(cur);
13381338
// Wait for RPL start
13391339
if (cur->bootsrap_mode == ARM_NWK_BOOTSRAP_MODE_6LoWPAN_BORDER_ROUTER) {
13401340
ws_bootstrap_event_routing_ready(cur);
@@ -1345,6 +1345,7 @@ static void ws_bootstrap_event_handler(arm_event_s *event)
13451345
break;
13461346
case WS_ROUTING_READY:
13471347
tr_info("Routing ready");
1348+
ws_bootstrap_advertise_start(cur);
13481349
ws_bootstrap_state_change(cur, ER_BOOTSRAP_DONE);
13491350
break;
13501351
case WS_ADDRESS_ADDED:
@@ -1483,7 +1484,13 @@ void ws_bootstrap_seconds_timer(protocol_interface_info_entry_t *cur, uint32_t s
14831484
}
14841485
if(trickle_timer(&cur->ws_info->trickle_pan_config_solicit, &trickle_params_pan_discovery, seconds)) {
14851486
// send PAN Configuration solicit
1487+
if (cur->ws_info->pas_requests > PCS_MAX) {
1488+
// if MAX PCS sent restart discovery
1489+
ws_bootstrap_event_discovery_start(cur);
1490+
return;
1491+
}
14861492
tr_info("Send PAN configuration Solicit");
1493+
cur->ws_info->pas_requests++;
14871494
ws_bootstrap_pan_config_solicit(cur);
14881495
}
14891496
if(trickle_timer(&cur->ws_info->trickle_pan_advertisement, &trickle_params_pan_discovery, seconds)) {

source/6LoWPAN/ws/ws_common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ typedef struct ws_info_s {
4848
trickle_t trickle_pan_advertisement_solicit;
4949
trickle_t trickle_pan_advertisement;
5050
uint8_t rpl_state; // state from rpl_event_t
51+
uint8_t pas_requests; // Amount of PAN solicits sent
5152
parent_info_t parent_info;
5253
uint32_t pan_version_timer; /**< border router version udate timeout */
5354
uint32_t pan_version_timeout_timer; /**< routers will fallback to previous state after this */

source/6LoWPAN/ws/ws_config.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,9 @@ extern int8_t DEVICE_MIN_SENS;
7474
/* Candidate parent Threshold hysteresis
7575
*/
7676
#define CAND_PARENT_HYSTERISIS 3
77-
#endif /* WS_CONFIG_H_ */
77+
78+
/* Maximum amount of Pan Configuration Solicits before restarting Discovery.
79+
*/
80+
#define PCS_MAX 5
81+
82+
#endif /* WS_CONFIG_H_ */

0 commit comments

Comments
 (0)