Skip to content

Commit

Permalink
Added ND proxy support to ws border router
Browse files Browse the repository at this point in the history
Change-Id: I9439c1bee730908c786377950999a77146559b59
  • Loading branch information
Juha Heiskanen committed Aug 8, 2018
1 parent f9b9e47 commit ab5d98a
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
34 changes: 34 additions & 0 deletions source/6LoWPAN/ws/ws_bbr_api.c
Expand Up @@ -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"

Expand Down Expand Up @@ -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;
Expand All @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions source/6LoWPAN/ws/ws_bootstrap.c
Expand Up @@ -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"
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit ab5d98a

Please sign in to comment.