* [Qemu-devel] [PATCH v2] [slirp] Make ARP replies at least 64 bytes long
@ 2010-09-15 20:33 Hervé Poussineau
2010-09-17 10:56 ` Edgar E. Iglesias
2010-09-20 11:43 ` [Qemu-devel] " Michael S. Tsirkin
0 siblings, 2 replies; 4+ messages in thread
From: Hervé Poussineau @ 2010-09-15 20:33 UTC (permalink / raw)
To: qemu-devel; +Cc: Hervé Poussineau
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 | 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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH v2] [slirp] Make ARP replies at least 64 bytes long
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 ` [Qemu-devel] " Michael S. Tsirkin
1 sibling, 0 replies; 4+ messages in thread
From: Edgar E. Iglesias @ 2010-09-17 10:56 UTC (permalink / raw)
To: Hervé Poussineau; +Cc: qemu-devel
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>
Applied, thanks.
> ---
> 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
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Qemu-devel] Re: [PATCH v2] [slirp] Make ARP replies at least 64 bytes long
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
2010-09-20 12:21 ` Paolo Bonzini
1 sibling, 1 reply; 4+ messages in thread
From: Michael S. Tsirkin @ 2010-09-20 11:43 UTC (permalink / raw)
To: Hervé Poussineau; +Cc: qemu-devel
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
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Qemu-devel] Re: [PATCH v2] [slirp] Make ARP replies at least 64 bytes long
2010-09-20 11:43 ` [Qemu-devel] " Michael S. Tsirkin
@ 2010-09-20 12:21 ` Paolo Bonzini
0 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2010-09-20 12:21 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: Hervé Poussineau, qemu-devel
On 09/20/2010 01:43 PM, Michael S. Tsirkin wrote:
> 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.
I don't think it matters if virtio-net needs it or net; slirp should
comply to RFC and standards, so it should make frames the correct size.
Paolo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-09-20 12:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [Qemu-devel] " Michael S. Tsirkin
2010-09-20 12:21 ` Paolo Bonzini
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).