From ab5d98a8f374de79d9938a4383f576cbe739b209 Mon Sep 17 00:00:00 2001 From: Juha Heiskanen Date: Wed, 8 Aug 2018 11:25:02 +0300 Subject: [PATCH 1/2] Added ND proxy support to ws border router Change-Id: I9439c1bee730908c786377950999a77146559b59 --- source/6LoWPAN/ws/ws_bbr_api.c | 34 ++++++++++++++++++++++++++++++++ source/6LoWPAN/ws/ws_bootstrap.c | 2 ++ 2 files changed, 36 insertions(+) diff --git a/source/6LoWPAN/ws/ws_bbr_api.c b/source/6LoWPAN/ws/ws_bbr_api.c index eae0b85fe92..a1e47be9729 100644 --- a/source/6LoWPAN/ws/ws_bbr_api.c +++ b/source/6LoWPAN/ws/ws_bbr_api.c @@ -32,6 +32,7 @@ #include "Common_Protocols/icmpv6.h" #include "Common_Protocols/icmpv6_radv.h" #include "net_rpl.h" +#include "Service_Libs/nd_proxy/nd_proxy.h" #include "6LoWPAN/ws/ws_bbr_api_internal.h" @@ -87,6 +88,37 @@ static void ws_bbr_rpl_root_activate(uint8_t *dodag_prefix, uint8_t *dodag_id) rpl_control_update_dodag_route(protocol_6lowpan_rpl_root_dodag, NULL, 0, 0, 0xffffffff, false); } +static int ws_border_router_proxy_validate(int8_t interface_id, uint8_t *address) +{ + + /* Could also check route type, but I don't think it really matters */ + ipv6_route_t *route; + route = ipv6_route_choose_next_hop(address, interface_id, NULL); + if (!route || route->prefix_len < 128) { + return -1; + } + + return 0; +} + +int ws_border_router_proxy_state_update(int8_t caller_interface_id, int8_t handler_interface_id, bool status) +{ + (void)caller_interface_id; + + protocol_interface_info_entry_t *cur = protocol_stack_interface_info_get_by_id(handler_interface_id); + if (!cur) { + tr_error("No Interface"); + return -1; + } + + if (status) { + tr_debug("Border router Backhaul link ready"); + } else { + tr_debug("Border router Backhaul link down"); + } + return 0; +} + static void ws_bbr_root_start(protocol_interface_info_entry_t *cur) { uint8_t *bbr_prefix_ptr = NULL; @@ -110,6 +142,8 @@ static void ws_bbr_root_start(protocol_interface_info_entry_t *cur) return; } ws_bbr_rpl_root_activate(bbr_prefix_ptr, bbr_dodag_id_ptr); + + nd_proxy_downstream_interface_register(cur->id, ws_border_router_proxy_validate, ws_border_router_proxy_state_update); } void ws_bbr_seconds_timer(protocol_interface_info_entry_t *cur, uint32_t seconds) diff --git a/source/6LoWPAN/ws/ws_bootstrap.c b/source/6LoWPAN/ws/ws_bootstrap.c index 3935415639a..c7a61802b33 100644 --- a/source/6LoWPAN/ws/ws_bootstrap.c +++ b/source/6LoWPAN/ws/ws_bootstrap.c @@ -53,6 +53,7 @@ #include "6LoWPAN/lowpan_adaptation_interface.h" #include "Service_Libs/etx/etx.h" #include "Service_Libs/mac_neighbor_table/mac_neighbor_table.h" +#include "Service_Libs/nd_proxy/nd_proxy.h" #include "platform/topo_trace.h" #include "net_rpl.h" @@ -305,6 +306,7 @@ static int8_t ws_bootstrap_down(protocol_interface_info_entry_t *cur) // Reset WS information // ws_common_reset(cur) ws_llc_reset(cur); + nd_proxy_downstream_interface_unregister(cur->id); return nwk_6lowpan_down(cur); } From 543dd1e73429d9a54a9d9416ec652da1409c5d34 Mon Sep 17 00:00:00 2001 From: Juha Heiskanen Date: Wed, 8 Aug 2018 13:27:47 +0300 Subject: [PATCH 2/2] Renamed symbol to micro seconds. --- nanostack/platform/arm_hal_phy.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nanostack/platform/arm_hal_phy.h b/nanostack/platform/arm_hal_phy.h index 522c9c8ea77..75c72ed3c43 100644 --- a/nanostack/platform/arm_hal_phy.h +++ b/nanostack/platform/arm_hal_phy.h @@ -58,8 +58,8 @@ typedef enum { PHY_EXTENSION_CONVERT_SIGNAL_INFO, /**< Convert signal info. */ PHY_EXTENSION_ACCEPT_ANY_BEACON, /**< Set boolean true or false for accept beacon from other Pan-ID than configured. Default value should be false */ 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.*/ - PHY_EXTENSION_READ_RX_TIME, /**< Read the time of last reception based on global symbol time stamp. */ - PHY_EXTENSION_READ_TX_FINNISH_TIME, /**< Read the time of last finished TX symbol based on global time stamp. */ + PHY_EXTENSION_READ_RX_TIME, /**< Read the time of last reception based on global micro seconds time stamp. */ + PHY_EXTENSION_READ_TX_FINNISH_TIME, /**< Read the time of last finished TX micro seconds based on global time stamp. */ 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*/ PHY_EXTENSION_GET_TIMESTAMP, /**< Read 32-bit constant monotonic time stamp in us */ 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*/