From f49d40a76b7e7c50360f4946b9141496823016c8 Mon Sep 17 00:00:00 2001 From: roblabla Date: Fri, 28 Jun 2019 18:51:30 +0000 Subject: [PATCH] Virtio: Fix reception of packet by skipping the NetHdr --- virtio/src/net.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/virtio/src/net.rs b/virtio/src/net.rs index ee3c72b65..e9f77ef66 100644 --- a/virtio/src/net.rs +++ b/virtio/src/net.rs @@ -12,7 +12,7 @@ use smoltcp::time::Instant; use core::fmt; use sunrise_libuser::error::Error; use bit_field::BitField; -use log::info; +use log::*; bitflags! { /// Features supported by the Virtio-Net driver. @@ -280,6 +280,7 @@ impl<'a> Device<'a> for VirtioNet { fn receive(&'a mut self) -> Option<(Self::RxToken, Self::TxToken)> { let buf = self.receive_queues().nth(0).unwrap().pop_buffer_w()?; + debug!("{:#?}", buf); let rx = VirtioNetRxToken(buf); let tx = VirtioNetTxToken(self); Some((rx, tx)) @@ -311,7 +312,8 @@ impl RxToken for VirtioNetRxToken { where F: FnOnce(&[u8]) -> smoltcp::Result { - f(&self.0[..]) + debug!("Consuming the buffer"); + f(&self.0[core::mem::size_of::()..]) } }