Skip to content

Commit

Permalink
Enable wi-sun dhcp relay service.
Browse files Browse the repository at this point in the history
  • Loading branch information
Juha Heiskanen committed Oct 18, 2018
1 parent 70e56b1 commit c2d0e14
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions source/6LoWPAN/ws/ws_bootstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1494,6 +1494,14 @@ static void ws_bootstrap_rpl_callback(rpl_event_t event, void *handle)
if (event == RPL_EVENT_DAO_DONE) {
// Trigger statemachine check
cur->bootsrap_state_machine_cnt = 1;
rpl_dodag_info_t dodag_info;
struct rpl_instance *instance = rpl_control_enumerate_instances(cur->rpl_domain, NULL);

if (instance && rpl_control_read_dodag_info(instance, &dodag_info)) {
tr_debug("Enable DHCPv6 relay");
dhcp_relay_agent_enable(cur->id, dodag_info.dodag_id);
}

ws_set_fhss_hop(cur);

} else if(event == RPL_EVENT_LOCAL_REPAIR_NO_MORE_DIS) {
Expand Down
3 changes: 3 additions & 0 deletions source/DHCPv6_client/dhcpv6_client_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,8 @@ void dhcp_client_global_address_renew(int8_t interface);
void dhcp_client_global_address_delete(int8_t interface, uint8_t dhcp_addr[static 16], uint8_t prefix[static 16]);


void dhcp_relay_agent_enable(int8_t interface, uint8_t border_router_address[static 16]);



#endif /* DHCPV6_CLIENT_API_H_ */
7 changes: 7 additions & 0 deletions source/DHCPv6_client/dhcpv6_client_service.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
typedef struct {
dhcp_client_global_adress_cb *global_address_cb;
uint16_t service_instance;
uint16_t relay_instance;
uint8_t libDhcp_instance;
int8_t interface;
} dhcp_client_class_t;
Expand All @@ -53,6 +54,12 @@ void dhcp_client_init(int8_t interface)
return;
}

void dhcp_relay_agent_enable(int8_t interface, uint8_t border_router_address[static 16])
{
dhcp_client.relay_instance = dhcp_service_init(interface, DHCP_INTANCE_RELAY_AGENT, NULL);
dhcp_service_relay_instance_enable(dhcp_client.relay_instance, border_router_address);
}

void dhcp_client_delete(int8_t interface)
{
protocol_interface_info_entry_t *cur = NULL;
Expand Down

0 comments on commit c2d0e14

Please sign in to comment.