32
32
#include "Common_Protocols/icmpv6.h"
33
33
#include "Common_Protocols/icmpv6_radv.h"
34
34
#include "net_rpl.h"
35
+ #include "Service_Libs/nd_proxy/nd_proxy.h"
35
36
36
37
#include "6LoWPAN/ws/ws_bbr_api_internal.h"
37
38
@@ -87,6 +88,37 @@ static void ws_bbr_rpl_root_activate(uint8_t *dodag_prefix, uint8_t *dodag_id)
87
88
rpl_control_update_dodag_route (protocol_6lowpan_rpl_root_dodag , NULL , 0 , 0 , 0xffffffff , false);
88
89
}
89
90
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
+
90
122
static void ws_bbr_root_start (protocol_interface_info_entry_t * cur )
91
123
{
92
124
uint8_t * bbr_prefix_ptr = NULL ;
@@ -110,6 +142,8 @@ static void ws_bbr_root_start(protocol_interface_info_entry_t *cur)
110
142
return ;
111
143
}
112
144
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 );
113
147
}
114
148
115
149
void ws_bbr_seconds_timer (protocol_interface_info_entry_t * cur , uint32_t seconds )
0 commit comments