From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=53248 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oxes7-00019V-U3 for qemu-devel@nongnu.org; Mon, 20 Sep 2010 07:49:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oxery-0004CH-7R for qemu-devel@nongnu.org; Mon, 20 Sep 2010 07:49:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42267) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oxerx-0004Bt-WC for qemu-devel@nongnu.org; Mon, 20 Sep 2010 07:49:14 -0400 Date: Mon, 20 Sep 2010 13:43:13 +0200 From: "Michael S. Tsirkin" Message-ID: <20100920114313.GA24864@redhat.com> References: <1284582806-4129-1-git-send-email-hpoussin@reactos.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <1284582806-4129-1-git-send-email-hpoussin@reactos.org> Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] Re: [PATCH v2] [slirp] Make ARP replies at least 64 bytes long List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?iso-8859-1?Q?Herv=E9?= Poussineau Cc: qemu-devel@nongnu.org On Wed, Sep 15, 2010 at 10:33:26PM +0200, Herv=E9 Poussineau wrote: > IEEE 802.3 standard requires Ethernet frames to be at least 64 bytes lo= ng. > If it is not the case, they will be considered as runt frames, and may = be ignored by netcard and/or OS >=20 > Signed-off-by: Herv=E9 Poussineau IMO slirp is not the best place for this, e.g. virtio-net does not need the padding.=20 > --- > slirp/slirp.c | 3 ++- > 1 files changed, 2 insertions(+), 1 deletions(-) >=20 > 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 =3D (struct ethhdr *)pkt; > struct arphdr *ah =3D (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 =3D (struct ethhdr *)arp_reply; > struct arphdr *rah =3D (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); > =20 > --=20 > 1.7.1.GIT >=20