From: Matias Elo <matias....@nokia.com>

Drop truncated packets received from kernel during sock_mmsg_recv() call.

Signed-off-by: Matias Elo <matias....@nokia.com>
---
/** Email created from pull request 397 (matiaselo:dev/pktio_fixes)
 ** https://github.com/Linaro/odp/pull/397
 ** Patch: https://github.com/Linaro/odp/pull/397.patch
 ** Base sha: 5a4502fc6bc53e6503169da3028f456b64811a0b
 ** Merge commit sha: 492c47d1c79534d1080b42047c948f1e19498ad3
 **/
 platform/linux-generic/pktio/socket.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/platform/linux-generic/pktio/socket.c 
b/platform/linux-generic/pktio/socket.c
index 7843b6113..5c86ff609 100644
--- a/platform/linux-generic/pktio/socket.c
+++ b/platform/linux-generic/pktio/socket.c
@@ -643,6 +643,11 @@ static int sock_mmsg_recv(pktio_entry_t *pktio_entry, int 
index ODP_UNUSED,
                uint16_t pkt_len = msgvec[i].msg_len;
                int ret;
 
+               if (odp_unlikely(msgvec[i].msg_hdr.msg_flags & MSG_TRUNC)) {
+                       odp_packet_free(pkt);
+                       ODP_DBG("dropped truncated packet\n");
+                       continue;
+               }
                if (pktio_cls_enabled(pktio_entry)) {
                        uint16_t seg_len =  pkt_len;
 

Reply via email to