All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Hervé Poussineau" <hpoussin@reactos.org>
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH v2] [slirp] Make ARP replies at least 64 bytes long
Date: Mon, 20 Sep 2010 13:43:13 +0200	[thread overview]
Message-ID: <20100920114313.GA24864@redhat.com> (raw)
In-Reply-To: <1284582806-4129-1-git-send-email-hpoussin@reactos.org>

On Wed, Sep 15, 2010 at 10:33:26PM +0200, Hervé Poussineau wrote:
> IEEE 802.3 standard requires Ethernet frames to be at least 64 bytes long.
> If it is not the case, they will be considered as runt frames, and may be ignored by netcard and/or OS
> 
> Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>

IMO slirp is not the best place for this, e.g. virtio-net
does not need the padding. 

> ---
>  slirp/slirp.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/slirp/slirp.c b/slirp/slirp.c
> index 82fd9b4..332d83b 100644
> --- a/slirp/slirp.c
> +++ b/slirp/slirp.c
> @@ -599,7 +599,7 @@ static void arp_input(Slirp *slirp, const uint8_t *pkt, int pkt_len)
>  {
>      struct ethhdr *eh = (struct ethhdr *)pkt;
>      struct arphdr *ah = (struct arphdr *)(pkt + ETH_HLEN);
> -    uint8_t arp_reply[ETH_HLEN + sizeof(struct arphdr)];
> +    uint8_t arp_reply[max(ETH_HLEN + sizeof(struct arphdr), 64)];
>      struct ethhdr *reh = (struct ethhdr *)arp_reply;
>      struct arphdr *rah = (struct arphdr *)(arp_reply + ETH_HLEN);
>      int ar_op;
> @@ -619,6 +619,7 @@ static void arp_input(Slirp *slirp, const uint8_t *pkt, int pkt_len)
>              }
>              return;
>          arp_ok:
> +            memset(arp_reply, 0, sizeof(arp_reply));
>              /* XXX: make an ARP request to have the client address */
>              memcpy(slirp->client_ethaddr, eh->h_source, ETH_ALEN);
>  
> -- 
> 1.7.1.GIT
> 

  parent reply	other threads:[~2010-09-20 11:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-15 20:33 [Qemu-devel] [PATCH v2] [slirp] Make ARP replies at least 64 bytes long Hervé Poussineau
2010-09-17 10:56 ` Edgar E. Iglesias
2010-09-20 11:43 ` Michael S. Tsirkin [this message]
2010-09-20 12:21   ` [Qemu-devel] " Paolo Bonzini

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=20100920114313.GA24864@redhat.com \
    --to=mst@redhat.com \
    --cc=hpoussin@reactos.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.