|
14 | 14 | #include <zephyr/net/net_if.h> |
15 | 15 | #include <zephyr/net/net_ip.h> |
16 | 16 | #include "sockets_internal.h" |
| 17 | +#include <platform-zephyr.h> |
17 | 18 |
|
18 | 19 | #define MAX_SERVICES 1 |
19 | 20 |
|
20 | 21 | static struct zsock_pollfd sockfd_udp[MAX_SERVICES]; |
21 | 22 | static int trel_sock = -1; |
22 | 23 | static struct otInstance *ot_instance_ptr; |
| 24 | +static struct net_if *ail_iface_ptr; |
23 | 25 | static otPlatTrelCounters trel_counters; |
24 | 26 | static bool trel_is_enabled; |
25 | 27 | static void trel_receive_handler(struct net_socket_service_event *evt); |
@@ -47,6 +49,11 @@ void otPlatTrelEnable(otInstance *aInstance, uint16_t *aUdpPort) |
47 | 49 |
|
48 | 50 | trel_is_enabled = true; |
49 | 51 |
|
| 52 | + if (ail_iface_ptr != NULL && net_if_is_up(ail_iface_ptr)) { |
| 53 | + (void)trel_plat_init(ot_instance_ptr, ail_iface_ptr); |
| 54 | + } |
| 55 | + |
| 56 | + |
50 | 57 | exit: |
51 | 58 | return; |
52 | 59 |
|
@@ -141,13 +148,14 @@ static void process_trel_message(struct otbr_msg_ctx *msg_ctx_ptr) |
141 | 148 | &msg_ctx_ptr->sock_addr); |
142 | 149 | } |
143 | 150 |
|
144 | | -otError trel_plat_init(otInstance *instance, struct net_if *ail_iface_ptr) |
| 151 | +otError trel_plat_init(otInstance *instance, struct net_if *ail_iface) |
145 | 152 | { |
146 | 153 | otError error = OT_ERROR_NONE; |
147 | 154 | struct ifreq if_req = {0}; |
148 | 155 | char name[CONFIG_NET_INTERFACE_NAME_LEN + 1] = {0}; |
149 | 156 |
|
150 | 157 | ot_instance_ptr = instance; |
| 158 | + ail_iface_ptr = ail_iface; |
151 | 159 |
|
152 | 160 | VerifyOrExit(net_if_get_name(ail_iface_ptr, name, |
153 | 161 | CONFIG_NET_INTERFACE_NAME_LEN) > 0, |
|
0 commit comments