From patchwork Thu Feb 10 22:54:28 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Rogers X-Patchwork-Id: 82680 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 9B0B9B7128 for ; Fri, 11 Feb 2011 09:55:06 +1100 (EST) Received: from localhost ([127.0.0.1]:50622 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PnfPj-0000Nl-6U for incoming@patchwork.ozlabs.org; Thu, 10 Feb 2011 17:55:03 -0500 Received: from [140.186.70.92] (port=45896 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PnfPH-0000Nd-FU for qemu-devel@nongnu.org; Thu, 10 Feb 2011 17:54:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PnfPF-0007tb-Sa for qemu-devel@nongnu.org; Thu, 10 Feb 2011 17:54:35 -0500 Received: from novprvoes0310.provo.novell.com ([137.65.248.74]:53281) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PnfPF-0007si-Hn for qemu-devel@nongnu.org; Thu, 10 Feb 2011 17:54:33 -0500 Received: from INET-PRV-MTA by novprvoes0310.provo.novell.com with Novell_GroupWise; Thu, 10 Feb 2011 15:54:30 -0700 Message-Id: <4D540A3402000048000A9C8C@novprvoes0310.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 8.0.2 Date: Thu, 10 Feb 2011 15:54:28 -0700 From: "Bruce Rogers" To: Mime-Version: 1.0 X-Mailfrom: brogers@brogers1.provo.novell.com Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Received-From: 137.65.248.74 Subject: [Qemu-devel] [PATCH] slirp: ensure minimum packet size X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org With recent gpxe eepro100 drivers, short packets are rejected, so ensure the minimum ethernet packet size. Signed-off-by: Bruce Rogers --- slirp/slirp.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/slirp/slirp.c b/slirp/slirp.c index 332d83b..b611cf7 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -697,7 +697,7 @@ void if_encap(Slirp *slirp, const uint8_t *ip_data, int ip_data_len) return; if (!memcmp(slirp->client_ethaddr, zero_ethaddr, ETH_ALEN)) { - uint8_t arp_req[ETH_HLEN + sizeof(struct arphdr)]; + uint8_t arp_req[max(ETH_HLEN + sizeof(struct arphdr), 64)]; struct ethhdr *reh = (struct ethhdr *)arp_req; struct arphdr *rah = (struct arphdr *)(arp_req + ETH_HLEN); const struct ip *iph = (const struct ip *)ip_data; @@ -734,7 +734,7 @@ void if_encap(Slirp *slirp, const uint8_t *ip_data, int ip_data_len) memcpy(&eh->h_source[2], &slirp->vhost_addr, 4); eh->h_proto = htons(ETH_P_IP); memcpy(buf + sizeof(struct ethhdr), ip_data, ip_data_len); - slirp_output(slirp->opaque, buf, ip_data_len + ETH_HLEN); + slirp_output(slirp->opaque, buf, max(ip_data_len + ETH_HLEN, 64)); } }