diff options
author | Steve Schrock <steve.schrock@getcruise.com> | 2024-04-08 19:46:05 +0000 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2024-04-08 17:12:56 -0500 |
commit | 6d4a89bbf07cf13d70009955ac613754259c754c (patch) | |
tree | 53a82c18719543e8ccc039af6a7c9a626ba7c618 | |
parent | 18dcd90cf0859d428bc47b76d7942ad3fc9f5a76 (diff) | |
download | ofono-6d4a89bbf07cf13d70009955ac613754259c754c.tar.gz |
qmi unit: Ignore QRTR control packets
Sometimes the test server will receive a QRTR_TYPE_DEL_CLIENT control
packet which is broadcast when the prior test client is destroyed. It
is entirely schdeduler-dependent as to whether this broadcast will
occur before or after the subsequent test's servers are created. If
the test server receives a control packet, then test_send_data will
fail. There is no need for the tests to be aware of any control
packets at this time so it should simply ignore them.
Fixes: 728db12daa68 ("qmi: Add unit test for QRTR qmi_service_send")
-rw-r--r-- | unit/test-qmimodem-qmi.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/unit/test-qmimodem-qmi.c b/unit/test-qmimodem-qmi.c index 3c5418be2..d04f50041 100644 --- a/unit/test-qmimodem-qmi.c +++ b/unit/test-qmimodem-qmi.c @@ -269,6 +269,11 @@ static bool received_data(struct l_io *io, void *user_data) addr_size = sizeof(addr); bytes_read = recvfrom(l_io_get_fd(io), buf, sizeof(buf), 0, (struct sockaddr *) &addr, &addr_size); + + /* Ignore control messages */ + if (addr.sq_port == QRTR_PORT_CTRL) + return true; + memcpy(&info->sender, &addr, sizeof(addr)); assert(!info->received); /* Only expect one message */ |