|
38 | 38 | #include "6LoWPAN/ws/ws_config.h"
|
39 | 39 | #include "6LoWPAN/ws/ws_common.h"
|
40 | 40 | #include "6LoWPAN/ws/ws_bootstrap.h"
|
| 41 | +#include "6LoWPAN/ws/ws_bbr_api_internal.h" |
41 | 42 | #include "RPL/rpl_protocol.h"
|
42 | 43 | #include "RPL/rpl_control.h"
|
43 | 44 | #include "RPL/rpl_data.h"
|
@@ -404,12 +405,17 @@ static void ws_bootstrap_pan_advertisement_analyse(struct protocol_interface_inf
|
404 | 405 | cur->bootsrap_state_machine_cnt = randLIB_get_random_in_range(10 ,30);
|
405 | 406 |
|
406 | 407 | tr_info("New possible parent found addr:%s", trace_array(cur->ws_info->parent_info.addr, 8));
|
407 |
| - } else { |
408 |
| - // Active state processing |
409 |
| - ws_bootstrap_pan_advertisement_analyse_active(cur, &pan_information); |
| 408 | + return; |
| 409 | + } |
| 410 | + // Active state processing |
| 411 | + ws_bootstrap_pan_advertisement_analyse_active(cur, &pan_information); |
| 412 | + |
| 413 | + // TODO Learn routing cost per neighbour |
| 414 | + |
| 415 | + // Learn latest network information |
| 416 | + if (cur->bootsrap_mode != ARM_NWK_BOOTSRAP_MODE_6LoWPAN_BORDER_ROUTER) { |
| 417 | + cur->ws_info->pan_configuration = pan_information; |
410 | 418 | }
|
411 |
| - // Parent valid store information |
412 |
| - cur->ws_info->parent_info.ws_utt = *ws_utt; |
413 | 419 | }
|
414 | 420 |
|
415 | 421 | static void ws_bootstrap_pan_advertisement_solicit_analyse(struct protocol_interface_info_entry *cur, const struct mcps_data_ind_s *data, ws_utt_ie_t *ws_utt, ws_us_ie_t *ws_us)
|
@@ -509,7 +515,8 @@ static void ws_bootstrap_pan_config_analyse(struct protocol_interface_info_entry
|
509 | 515 | //Border router does not learn network information
|
510 | 516 | return;
|
511 | 517 | }
|
512 |
| - if (cur->ws_info->pan_configuration.pan_version == pan_version) { |
| 518 | + if (cur->ws_info->configuration_learned && |
| 519 | + cur->ws_info->pan_configuration.pan_version == pan_version) { |
513 | 520 | // No new information
|
514 | 521 | return;
|
515 | 522 | }
|
@@ -1077,6 +1084,11 @@ static void ws_bootstrap_pan_advert(protocol_interface_info_entry_t *cur)
|
1077 | 1084 | async_req.channel_list.channel_page = CHANNEL_PAGE_10;
|
1078 | 1085 | async_req.security.SecurityLevel = 0;
|
1079 | 1086 |
|
| 1087 | + if (cur->bootsrap_mode == ARM_NWK_BOOTSRAP_MODE_6LoWPAN_BORDER_ROUTER) { |
| 1088 | + // Border routers write the NW size |
| 1089 | + cur->ws_info->pan_configuration.pan_size = ws_bbr_pan_size(cur); |
| 1090 | + } |
| 1091 | + |
1080 | 1092 | ws_llc_asynch_request(cur, &async_req);
|
1081 | 1093 | }
|
1082 | 1094 |
|
@@ -1136,7 +1148,7 @@ static void ws_bootstrap_event_handler(arm_event_s *event)
|
1136 | 1148 | if (cur->bootsrap_mode == ARM_NWK_BOOTSRAP_MODE_6LoWPAN_BORDER_ROUTER) {
|
1137 | 1149 | tr_debug("Border router start network");
|
1138 | 1150 | cur->ws_info->network_pan_id = randLIB_get_random_in_range(0,0xfffd);
|
1139 |
| - cur->ws_info->pan_configuration.pan_size = 3; |
| 1151 | + cur->ws_info->pan_configuration.pan_size = 0; |
1140 | 1152 | cur->ws_info->pan_configuration.pan_version = randLIB_get_random_in_range(0,0xffff);
|
1141 | 1153 | cur->ws_info->pan_configuration.routing_cost = 0;
|
1142 | 1154 | cur->ws_info->pan_configuration.rpl_routing_method = true;
|
|
0 commit comments