mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-29 05:13:54 -06:00
net: introduce qemu_receive_packet()
Some NIC supports loopback mode and this is done by calling nc->info->receive() directly which in fact suppresses the effort of reentrancy check that is done in qemu_net_queue_send(). Unfortunately we can't use qemu_net_queue_send() here since for loopback there's no sender as peer, so this patch introduce a qemu_receive_packet() which is used for implementing loopback mode for a NIC with this check. NIC that supports loopback mode will be converted to this helper. This is intended to address CVE-2021-3416. Cc: Prasad J Pandit <ppandit@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Cc: qemu-stable@nongnu.org Signed-off-by: Jason Wang <jasowang@redhat.com>
This commit is contained in:
parent
3de46e6fc4
commit
705df5466c
4 changed files with 66 additions and 7 deletions
|
@ -144,12 +144,17 @@ void *qemu_get_nic_opaque(NetClientState *nc);
|
|||
void qemu_del_net_client(NetClientState *nc);
|
||||
typedef void (*qemu_nic_foreach)(NICState *nic, void *opaque);
|
||||
void qemu_foreach_nic(qemu_nic_foreach func, void *opaque);
|
||||
int qemu_can_receive_packet(NetClientState *nc);
|
||||
int qemu_can_send_packet(NetClientState *nc);
|
||||
ssize_t qemu_sendv_packet(NetClientState *nc, const struct iovec *iov,
|
||||
int iovcnt);
|
||||
ssize_t qemu_sendv_packet_async(NetClientState *nc, const struct iovec *iov,
|
||||
int iovcnt, NetPacketSent *sent_cb);
|
||||
ssize_t qemu_send_packet(NetClientState *nc, const uint8_t *buf, int size);
|
||||
ssize_t qemu_receive_packet(NetClientState *nc, const uint8_t *buf, int size);
|
||||
ssize_t qemu_receive_packet_iov(NetClientState *nc,
|
||||
const struct iovec *iov,
|
||||
int iovcnt);
|
||||
ssize_t qemu_send_packet_raw(NetClientState *nc, const uint8_t *buf, int size);
|
||||
ssize_t qemu_send_packet_async(NetClientState *nc, const uint8_t *buf,
|
||||
int size, NetPacketSent *sent_cb);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue