qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Hervé Poussineau" <hpoussin@reactos.org>
To: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
Cc: "Hervé Poussineau" <hpoussin@reactos.org>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] [slirp] Make ARP replies at least 64 bytes long
Date: Wed, 15 Sep 2010 21:39:02 +0200	[thread overview]
Message-ID: <4C9120D6.9010207@reactos.org> (raw)
In-Reply-To: <20100914222257.GB16690@laped.lan>

Edgar E. Iglesias a écrit :
> On Mon, Sep 13, 2010 at 11:02:42PM +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>
>> ---
>>  slirp/slirp.c |   12 ++++++++----
>>  1 files changed, 8 insertions(+), 4 deletions(-)
>>
>> diff --git a/slirp/slirp.c b/slirp/slirp.c
>> index 82fd9b4..2e8c017 100644
>> --- a/slirp/slirp.c
>> +++ b/slirp/slirp.c
>> @@ -599,9 +599,12 @@ 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)];
>> -    struct ethhdr *reh = (struct ethhdr *)arp_reply;
>> -    struct arphdr *rah = (struct arphdr *)(arp_reply + ETH_HLEN);
>> +    union {
>> +        uint8_t data[ETH_HLEN + sizeof(struct arphdr)];
>> +        uint8_t payload[64]; /* Minimum Ethernet frame size */
>> +    } arp_reply;
>> +    struct ethhdr *reh = (struct ethhdr *)arp_reply.data;
>> +    struct arphdr *rah = (struct arphdr *)(arp_reply.data + ETH_HLEN);
>>     
>
>
> Hi,
>
> Would you mind explaning the point of the union here? Why not just
> do something like:
>
> -    uint8_t arp_reply[ETH_HLEN + sizeof(struct arphdr)];
> +    uint8_t arp_reply[MAX(ETH_HLEN + sizeof(struct arphdr), 64)];
>
>   
Good idea. I'll send an updated patch soon.

Hervé

      reply	other threads:[~2010-09-15 19:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-13 21:02 [Qemu-devel] [PATCH] [slirp] Make ARP replies at least 64 bytes long Hervé Poussineau
2010-09-14 22:22 ` Edgar E. Iglesias
2010-09-15 19:39   ` Hervé Poussineau [this message]

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=4C9120D6.9010207@reactos.org \
    --to=hpoussin@reactos.org \
    --cc=edgar.iglesias@gmail.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).