Skip to content

Commit ab5d98a

Browse files
author
Juha Heiskanen
committed
Added ND proxy support to ws border router
Change-Id: I9439c1bee730908c786377950999a77146559b59
1 parent f9b9e47 commit ab5d98a

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

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)