diff --git a/vm-virtio/src/net_util.rs b/vm-virtio/src/net_util.rs index 43e0f3dd9..00394b381 100644 --- a/vm-virtio/src/net_util.rs +++ b/vm-virtio/src/net_util.rs @@ -430,7 +430,15 @@ impl RxVirtio { // Mark that we have at least one pending packet and we need to interrupt the guest. self.deferred_irqs = true; - write_count >= self.bytes_read + // Update the frame_buf buffer. + if write_count < self.bytes_read { + self.frame_buf.copy_within(write_count..self.bytes_read, 0); + self.bytes_read -= write_count; + false + } else { + self.bytes_read = 0; + true + } } }