Skip to content

Commit 4cec954

Browse files
Cristib05fabiobaltieri
authored andcommitted
net: l2: openthread: Add DHCP6_PD, DNS upstream resolver and SRP server
- Initialize platform requirements and start OpenThread DHCP6_PD feature. - Added initialization logic for DNS upstream resolver. OTBR message data structure has been updated to store a user data structure, if needed. - Added SRP server initialization call. Signed-off-by: Cristian Bulacu <[email protected]>
1 parent f836a9e commit 4cec954

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

subsys/net/l2/openthread/openthread_border_router.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#include <openthread/backbone_router_ftd.h>
1010
#include <openthread/border_router.h>
1111
#include <openthread/border_routing.h>
12+
#include <openthread/dnssd_server.h>
13+
#include <openthread/srp_server.h>
1214
#include <openthread/link.h>
1315
#include <openthread/mdns.h>
1416
#include <openthread/thread.h>
@@ -93,11 +95,21 @@ int openthread_start_border_router_services(struct net_if *ot_iface, struct net_
9395
error = -EIO;
9496
goto exit;
9597
}
98+
if (dhcpv6_pd_client_init(instance, ail_iface_index) != OT_ERROR_NONE) {
99+
error = -EIO;
100+
goto exit;
101+
}
96102

97103
if (border_agent_init(instance) != OT_ERROR_NONE) {
98104
error = -EIO;
99105
goto exit;
100106
}
107+
#if defined(CONFIG_OPENTHREAD_DNS_UPSTREAM_QUERY)
108+
if (dns_upstream_resolver_init(instance) != OT_ERROR_NONE) {
109+
error = -EIO;
110+
goto exit;
111+
}
112+
#endif /* CONFIG_OPENTHREAD_DNS_UPSTREAM_QUERY */
101113

102114
/* Call OpenThread API */
103115
if (otBorderRoutingInit(instance, ail_iface_index, true) != OT_ERROR_NONE) {
@@ -112,7 +124,14 @@ int openthread_start_border_router_services(struct net_if *ot_iface, struct net_
112124
error = -EIO;
113125
goto exit;
114126
}
127+
128+
otBorderRoutingDhcp6PdSetEnabled(instance, true);
115129
otBackboneRouterSetEnabled(instance, true);
130+
otSrpServerSetAutoEnableMode(instance, true);
131+
132+
#if defined(CONFIG_OPENTHREAD_DNS_UPSTREAM_QUERY)
133+
otDnssdUpstreamQuerySetEnabled(instance, true);
134+
#endif /* CONFIG_OPENTHREAD_DNS_UPSTREAM_QUERY */
116135

117136
openthread_mutex_unlock();
118137

subsys/net/l2/openthread/openthread_border_router.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ struct otbr_msg_ctx {
9494
/** Actual length of incoming data */
9595
uint16_t length;
9696

97+
/** A pointer to user data */
98+
void *user_data;
9799
union {
98100
/** Generic OpenThread message info structure */
99101
otMessageInfo message_info;

0 commit comments

Comments
 (0)