qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Akihiko Odaki <akihiko.odaki@gmail.com>
To: Laurent Vivier <lvivier@redhat.com>, qemu-devel@nongnu.org
Cc: Jason Wang <jasowang@redhat.com>
Subject: Re: [PATCH 1/2] net: Fix announce_self
Date: Sat, 18 Jan 2025 19:09:13 +0900	[thread overview]
Message-ID: <0e59f286-15d1-426a-8012-0370b07f149c@gmail.com> (raw)
In-Reply-To: <20250117111709.970789-2-lvivier@redhat.com>

On 2025/01/17 20:17, Laurent Vivier wrote:
> b9ad513e1876 ("net: Remove receive_raw()") adds an iovec entry
> in qemu_deliver_packet_iov() to add the virtio-net header
> in the data when QEMU_NET_PACKET_FLAG_RAW is set but forgets
> to increase the number of iovec entries in the array, so
> receive_iov() will only send the first entry (the virtio-net
> entry, full of 0) and no data. The packet will be discarded.
> 
> The only user of QEMU_NET_PACKET_FLAG_RAW is announce_self.
> 
> We can see the problem with tcpdump:
> 
> - QEMU parameters:
> 
>    .. -monitor stdio \
>       -netdev bridge,id=netdev0,br=virbr0 \
>       -device virtio-net,mac=9a:2b:2c:2d:2e:2f,netdev=netdev0 \
> 
> - HMP command:
> 
>    (qemu) announce_self
> 
> - TCP dump:
> 
>    $ sudo tcpdump -nxi virbr0
> 
>    without the fix:
> 
>      <nothing>
> 
>    with the fix:
> 
>     ARP, Reverse Request who-is 9a:2b:2c:2d:2e:2f tell 9a:2b:2c:2d:2e:2f, length 46
>          0x0000:  0001 0800 0604 0003 9a2b 2c2d 2e2f 0000
>          0x0010:  0000 9a2b 2c2d 2e2f 0000 0000 0000 0000
>          0x0020:  0000 0000 0000 0000 0000 0000 0000
> 
> Reported-by: Xiaohui Li <xiaohli@redhat.com>
> Bug: https://issues.redhat.com/browse/RHEL-73891
> Fixes: b9ad513e1876 ("net: Remove receive_raw()")
> Cc: akihiko.odaki@daynix.com
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>

Thanks for finding out this bug:

Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>

I believe this should have:

Cc: qemu-stable@nongnu.org

> ---
>   net/net.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/net/net.c b/net/net.c
> index c1bb19a52373..9cded70dde74 100644
> --- a/net/net.c
> +++ b/net/net.c
> @@ -822,6 +822,7 @@ static ssize_t qemu_deliver_packet_iov(NetClientState *sender,
>           iov_copy[0].iov_len =  nc->vnet_hdr_len;
>           memcpy(&iov_copy[1], iov, iovcnt * sizeof(*iov));
>           iov = iov_copy;
> +        iovcnt++;
>       }
>   
>       if (nc->info->receive_iov) {



  reply	other threads:[~2025-01-18 10:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-17 11:17 [PATCH 0/2] net: Fix announce_self with vhost Laurent Vivier
2025-01-17 11:17 ` [PATCH 1/2] net: Fix announce_self Laurent Vivier
2025-01-18 10:09   ` Akihiko Odaki [this message]
2025-01-20  0:34   ` Jason Wang
2025-01-17 11:17 ` [PATCH 2/2] net/dump: Correctly compute Ethernet packet offset Laurent Vivier
2025-01-18 10:12   ` Akihiko Odaki
2025-01-20  0:34   ` Jason Wang
2025-01-17 14:05 ` [PATCH 0/2] net: Fix announce_self with vhost Laurent Vivier
2025-02-01 19:36   ` Michael Tokarev
2025-02-02 17:28     ` Laurent Vivier
2025-01-18 20:20 ` Michael Tokarev
2025-01-30  9:29   ` Laurent Vivier
2025-01-30 10:00     ` Michael Tokarev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0e59f286-15d1-426a-8012-0370b07f149c@gmail.com \
    --to=akihiko.odaki@gmail.com \
    --cc=jasowang@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).