Skip to content

Commit d4245ca

Browse files
committed
applications: serial_lte_modem: Fix XUDPDATA
XUDPDATA should always include the IP address of the remote party. Signed-off-by: Markus Lassila <markus.lassila@nordicsemi.no>
1 parent 103d927 commit d4245ca

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

applications/serial_lte_modem/src/slm_at_udp_proxy.c

+6-12
Original file line numberDiff line numberDiff line change
@@ -392,18 +392,12 @@ static void udp_thread_func(void *p1, void *p2, void *p3)
392392
LOG_DBG("sock events 0x%08x", fds[SOCK].revents);
393393
LOG_DBG("efd events 0x%08x", fds[EVENT_FD].revents);
394394
if ((fds[SOCK].revents & ZSOCK_POLLIN) != 0) {
395-
if (proxy.role == UDP_ROLE_SERVER) {
396-
/* Store the remote to send responses with the #XUDPSEND command. */
397-
unsigned int size = sizeof(proxy.remote);
398-
399-
memset(&proxy.remote, 0, sizeof(proxy.remote));
400-
ret = zsock_recvfrom(proxy.sock, (void *)slm_data_buf,
401-
sizeof(slm_data_buf), ZSOCK_MSG_DONTWAIT,
402-
(struct sockaddr *)&proxy.remote, &size);
403-
} else {
404-
ret = zsock_recv(proxy.sock, (void *)slm_data_buf,
405-
sizeof(slm_data_buf), ZSOCK_MSG_DONTWAIT);
406-
}
395+
unsigned int size = sizeof(proxy.remote);
396+
397+
memset(&proxy.remote, 0, sizeof(proxy.remote));
398+
ret = zsock_recvfrom(proxy.sock, (void *)slm_data_buf,
399+
sizeof(slm_data_buf), ZSOCK_MSG_DONTWAIT,
400+
(struct sockaddr *)&proxy.remote, &size);
407401
if (ret < 0 && errno != EAGAIN) {
408402
LOG_WRN("zsock_recv() error: %d", -errno);
409403
} else if (ret > 0) {

0 commit comments

Comments
 (0)