Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: source/borderrouter_tasklet.c
- Revision:
- 82:3d9e3b7b3dcf
- Parent:
- 65:92e581c01e8c
- Child:
- 89:2f7ae1d76d7a
diff -r afdeda18ff0c -r 3d9e3b7b3dcf source/borderrouter_tasklet.c --- a/source/borderrouter_tasklet.c Thu Nov 22 11:15:40 2018 +0000 +++ b/source/borderrouter_tasklet.c Fri Nov 23 14:45:35 2018 +0000 @@ -36,6 +36,7 @@ #define NR_BACKHAUL_INTERFACE_PHY_DRIVER_READY 2 #define NR_BACKHAUL_INTERFACE_PHY_DOWN 3 +const uint8_t addr_unspecified[16] = {0}; static mac_api_t *api; static eth_mac_api_t *eth_mac_api; @@ -329,17 +330,14 @@ .receiver = br_tasklet_id, .priority = ARM_LIB_MED_PRIORITY_EVENT, .event_type = APPLICATION_EVENT, + .event_id = NR_BACKHAUL_INTERFACE_PHY_DOWN, .event_data = driver_id }; if (link_up) { event.event_id = NR_BACKHAUL_INTERFACE_PHY_DRIVER_READY; - } else { - event.event_id = NR_BACKHAUL_INTERFACE_PHY_DOWN; } - tr_debug("Backhaul driver ID: %d", driver_id); - eventOS_event_send(&event); } @@ -357,7 +355,7 @@ if (backhaul_if_id >= 0) { tr_debug("Backhaul interface ID: %d", backhaul_if_id); - if (memcmp(backhaul_prefix, (const uint8_t[8]) { 0 }, 8) == 0) { + if (memcmp(backhaul_prefix, addr_unspecified, 8) == 0) { memcpy(backhaul_prefix, rpl_setup_info.DODAG_ID, 8); } arm_nwk_interface_configure_ipv6_bootstrap_set( @@ -406,6 +404,8 @@ net_backhaul_state = INTERFACE_IDLE_STATE; } + tr_debug("Backhaul driver ID: %d", net_backhaul_id); + if (backhaul_interface_up(net_backhaul_id) != 0) { tr_debug("Backhaul bootstrap start failed"); } else { @@ -413,6 +413,7 @@ net_backhaul_state = INTERFACE_BOOTSTRAP_ACTIVE; } } else if (event->event_id == NR_BACKHAUL_INTERFACE_PHY_DOWN) { + tr_debug("Backhaul driver ID: %d", (int8_t) event->event_data); if (backhaul_interface_down() != 0) { tr_error("Backhaul interface down failed"); } else { @@ -424,7 +425,7 @@ break; case ARM_LIB_TASKLET_INIT_EVENT: - print_appl_info(); + appl_info_trace(); br_tasklet_id = event->receiver; /* initialize the backhaul interface */ @@ -475,7 +476,7 @@ // configure as border router and set the operation mode retval = arm_nwk_interface_configure_6lowpan_bootstrap_set(net_6lowpan_id, - operating_mode, operating_mode_extension); + operating_mode, operating_mode_extension); if (retval < 0) { tr_error("Configuring 6LoWPAN bootstrap failed, retval = %d", retval); @@ -504,7 +505,7 @@ /* configure both /64 and /128 context prefixes */ retval = arm_nwk_6lowpan_border_router_context_update(net_6lowpan_id, ((1 << 4) | 0x03), - 128, 0xffff, rpl_setup_info.DODAG_ID); + 128, 0xffff, rpl_setup_info.DODAG_ID); if (retval < 0) { tr_error("Setting ND context failed, retval = %d", retval); @@ -599,14 +600,12 @@ } if (backhaul_bootstrap_mode == NET_IPV6_BOOTSTRAP_STATIC) { + uint8_t *next_hop_ptr; int8_t retval; - uint8_t *next_hop_ptr; - - if (memcmp(backhaul_route.next_hop, (const uint8_t[16]) {0}, 16) == 0) { + if (memcmp(backhaul_route.next_hop, addr_unspecified, 16) == 0) { tr_info("Next hop not defined"); next_hop_ptr = NULL; - } - else { + } else { next_hop_ptr = backhaul_route.next_hop; }