Skip to content

Commit c2d0e14

Browse files
author
Juha Heiskanen
committed
Enable wi-sun dhcp relay service.
1 parent 70e56b1 commit c2d0e14

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

source/6LoWPAN/ws/ws_bootstrap.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1494,6 +1494,14 @@ static void ws_bootstrap_rpl_callback(rpl_event_t event, void *handle)
14941494
if (event == RPL_EVENT_DAO_DONE) {
14951495
// Trigger statemachine check
14961496
cur->bootsrap_state_machine_cnt = 1;
1497+
rpl_dodag_info_t dodag_info;
1498+
struct rpl_instance *instance = rpl_control_enumerate_instances(cur->rpl_domain, NULL);
1499+
1500+
if (instance && rpl_control_read_dodag_info(instance, &dodag_info)) {
1501+
tr_debug("Enable DHCPv6 relay");
1502+
dhcp_relay_agent_enable(cur->id, dodag_info.dodag_id);
1503+
}
1504+
14971505
ws_set_fhss_hop(cur);
14981506

14991507
} else if(event == RPL_EVENT_LOCAL_REPAIR_NO_MORE_DIS) {

source/DHCPv6_client/dhcpv6_client_api.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,5 +81,8 @@ void dhcp_client_global_address_renew(int8_t interface);
8181
void dhcp_client_global_address_delete(int8_t interface, uint8_t dhcp_addr[static 16], uint8_t prefix[static 16]);
8282

8383

84+
void dhcp_relay_agent_enable(int8_t interface, uint8_t border_router_address[static 16]);
85+
86+
8487

8588
#endif /* DHCPV6_CLIENT_API_H_ */

source/DHCPv6_client/dhcpv6_client_service.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
typedef struct {
3535
dhcp_client_global_adress_cb *global_address_cb;
3636
uint16_t service_instance;
37+
uint16_t relay_instance;
3738
uint8_t libDhcp_instance;
3839
int8_t interface;
3940
} dhcp_client_class_t;
@@ -53,6 +54,12 @@ void dhcp_client_init(int8_t interface)
5354
return;
5455
}
5556

57+
void dhcp_relay_agent_enable(int8_t interface, uint8_t border_router_address[static 16])
58+
{
59+
dhcp_client.relay_instance = dhcp_service_init(interface, DHCP_INTANCE_RELAY_AGENT, NULL);
60+
dhcp_service_relay_instance_enable(dhcp_client.relay_instance, border_router_address);
61+
}
62+
5663
void dhcp_client_delete(int8_t interface)
5764
{
5865
protocol_interface_info_entry_t *cur = NULL;

0 commit comments

Comments
 (0)