Skip to content

Commit b693eae

Browse files
authored
Merge pull request ARMmbed#1778 from ARMmbed/ws_bbr_update
Added ND proxy support to ws border router
2 parents f9b9e47 + 543dd1e commit b693eae

File tree

3 files changed

+38
-2
lines changed

3 files changed

+38
-2
lines changed

nanostack/platform/arm_hal_phy.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ typedef enum {
5858
PHY_EXTENSION_CONVERT_SIGNAL_INFO, /**< Convert signal info. */
5959
PHY_EXTENSION_ACCEPT_ANY_BEACON, /**< Set boolean true or false for accept beacon from other Pan-ID than configured. Default value should be false */
6060
PHY_EXTENSION_SET_TX_TIME, /**< Net library sets transmission time based on global time stamp. Max. 65ms from setting to TX. If TX time is set to zero, it should be ignored.*/
61-
PHY_EXTENSION_READ_RX_TIME, /**< Read the time of last reception based on global symbol time stamp. */
62-
PHY_EXTENSION_READ_TX_FINNISH_TIME, /**< Read the time of last finished TX symbol based on global time stamp. */
61+
PHY_EXTENSION_READ_RX_TIME, /**< Read the time of last reception based on global micro seconds time stamp. */
62+
PHY_EXTENSION_READ_TX_FINNISH_TIME, /**< Read the time of last finished TX micro seconds based on global time stamp. */
6363
PHY_EXTENSION_DYNAMIC_RF_SUPPORTED, /**< Read status for support Radio driver support for set TX time, CCA and Timestamp read. Also PHY_LINK_CCA_PREPARE tx status must be supported also*/
6464
PHY_EXTENSION_GET_TIMESTAMP, /**< Read 32-bit constant monotonic time stamp in us */
6565
PHY_EXTENSION_SET_CSMA_PARAMETERS, /**< CSMA parameter's are given by phy_csma_params_t structure remember type cast uint8_t pointer to structure type*/

source/6LoWPAN/ws/ws_bbr_api.c

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "Common_Protocols/icmpv6.h"
3333
#include "Common_Protocols/icmpv6_radv.h"
3434
#include "net_rpl.h"
35+
#include "Service_Libs/nd_proxy/nd_proxy.h"
3536

3637
#include "6LoWPAN/ws/ws_bbr_api_internal.h"
3738

@@ -87,6 +88,37 @@ static void ws_bbr_rpl_root_activate(uint8_t *dodag_prefix, uint8_t *dodag_id)
8788
rpl_control_update_dodag_route(protocol_6lowpan_rpl_root_dodag, NULL, 0, 0, 0xffffffff, false);
8889
}
8990

91+
static int ws_border_router_proxy_validate(int8_t interface_id, uint8_t *address)
92+
{
93+
94+
/* Could also check route type, but I don't think it really matters */
95+
ipv6_route_t *route;
96+
route = ipv6_route_choose_next_hop(address, interface_id, NULL);
97+
if (!route || route->prefix_len < 128) {
98+
return -1;
99+
}
100+
101+
return 0;
102+
}
103+
104+
int ws_border_router_proxy_state_update(int8_t caller_interface_id, int8_t handler_interface_id, bool status)
105+
{
106+
(void)caller_interface_id;
107+
108+
protocol_interface_info_entry_t *cur = protocol_stack_interface_info_get_by_id(handler_interface_id);
109+
if (!cur) {
110+
tr_error("No Interface");
111+
return -1;
112+
}
113+
114+
if (status) {
115+
tr_debug("Border router Backhaul link ready");
116+
} else {
117+
tr_debug("Border router Backhaul link down");
118+
}
119+
return 0;
120+
}
121+
90122
static void ws_bbr_root_start(protocol_interface_info_entry_t *cur)
91123
{
92124
uint8_t *bbr_prefix_ptr = NULL;
@@ -110,6 +142,8 @@ static void ws_bbr_root_start(protocol_interface_info_entry_t *cur)
110142
return;
111143
}
112144
ws_bbr_rpl_root_activate(bbr_prefix_ptr, bbr_dodag_id_ptr);
145+
146+
nd_proxy_downstream_interface_register(cur->id, ws_border_router_proxy_validate, ws_border_router_proxy_state_update);
113147
}
114148

115149
void ws_bbr_seconds_timer(protocol_interface_info_entry_t *cur, uint32_t seconds)

source/6LoWPAN/ws/ws_bootstrap.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
#include "6LoWPAN/lowpan_adaptation_interface.h"
5454
#include "Service_Libs/etx/etx.h"
5555
#include "Service_Libs/mac_neighbor_table/mac_neighbor_table.h"
56+
#include "Service_Libs/nd_proxy/nd_proxy.h"
5657
#include "platform/topo_trace.h"
5758

5859
#include "net_rpl.h"
@@ -305,6 +306,7 @@ static int8_t ws_bootstrap_down(protocol_interface_info_entry_t *cur)
305306
// Reset WS information
306307
// ws_common_reset(cur)
307308
ws_llc_reset(cur);
309+
nd_proxy_downstream_interface_unregister(cur->id);
308310

309311
return nwk_6lowpan_down(cur);
310312
}

0 commit comments

Comments
 (0)