mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
net_util: queue_pair: Handle TX short tap write gracefully
When writev returns fewer bytes than vnet_hdr_len the packet is truncated. Log the error and drop it instead of returning a fatal InvalidVirtioNetHeader error that would crash the worker thread. Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
committed by
Rob Bradford
parent
17fefa1e45
commit
02ea839838
@@ -127,7 +127,8 @@ impl TxVirtio {
|
||||
return Err(NetQueuePairError::WriteTap(e));
|
||||
}
|
||||
} else if (result as usize) < vnet_hdr_len() {
|
||||
return Err(NetQueuePairError::InvalidVirtioNetHeader);
|
||||
error!("net: tx: short tap write ({result} < {})", vnet_hdr_len());
|
||||
0
|
||||
} else {
|
||||
self.counter_bytes += Wrapping(result as u64 - vnet_hdr_len() as u64);
|
||||
self.counter_frames += Wrapping(1);
|
||||
|
||||
Reference in New Issue
Block a user