From: Jason Wang <[email protected]>

filter-redirector forwards packets to a chardev (outdev). The backend write
path may return 0 or a negative error even though the filter has consumed
(and should account for) the packet.

Returning 0 propagates back to the sender (e.g. tap backend) as "cannot send"
and can cause polling to be disabled, preventing further draining of tap
traffic into the netfilter chain.

Always report the packet as consumed by returning iov_size() when outdev is
connected. Errors are still reported, but the data path is kept progressing.

Signed-off-by: Jason Wang <[email protected]>
Signed-off-by: Cindy Lu <[email protected]>
---
 net/filter-mirror.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/filter-mirror.c b/net/filter-mirror.c
index 21598b97a7..eb703b7dee 100644
--- a/net/filter-mirror.c
+++ b/net/filter-mirror.c
@@ -247,7 +247,7 @@ static ssize_t filter_redirector_receive_iov(NetFilterState 
*nf,
             s->outdev_packets++;
             s->outdev_bytes += ret;
         }
-        return ret;
+        return iov_size(iov, iovcnt);
     } else {
         return 0;
     }
-- 
2.52.0


Reply via email to