Skip to content

Commit 58743ee

Browse files
Cristib05henrikbrixandersen
authored andcommitted
modules: openthread: udp: Allow IPV4 traffic to OT UDP sockets
When CONFIG_NET_IPV4 && CONFIG_NET_IPV4_MAPPING_TO_IPV6 are enabled, allow IPV4 traffic to platform sockets by setting IPV6_ONLY to 0. Signed-off-by: Cristian Bulacu <[email protected]>
1 parent ecd455b commit 58743ee

File tree

1 file changed

+7
-0
lines changed
  • modules/openthread/platform

1 file changed

+7
-0
lines changed

modules/openthread/platform/udp.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,13 @@ otError otPlatUdpSocket(otUdpSocket *aUdpSocket)
7474
sock = zsock_socket(AF_INET6, SOCK_DGRAM | SOCK_NONBLOCK, IPPROTO_UDP);
7575
VerifyOrExit(sock >= 0, error = OT_ERROR_FAILED);
7676

77+
#if defined(CONFIG_NET_IPV4) && defined(CONFIG_NET_IPV4_MAPPING_TO_IPV6)
78+
int off = 0;
79+
80+
VerifyOrExit(zsock_setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, &off, sizeof(off)) == 0,
81+
error = OT_ERROR_FAILED);
82+
#endif
83+
7784
aUdpSocket->mHandle = INT_TO_POINTER(sock);
7885

7986
for (idx = 0; idx < CONFIG_OPENTHREAD_ZEPHYR_BORDER_ROUTER_MAX_UDP_SERVICES; idx++) {

0 commit comments

Comments
 (0)