From patchwork Mon Jun 27 12:41:51 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabien Chouteau X-Patchwork-Id: 102155 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 1607CB6F54 for ; Mon, 27 Jun 2011 22:45:33 +1000 (EST) Received: from localhost ([::1]:47361 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QbBBy-0006bj-6i for incoming@patchwork.ozlabs.org; Mon, 27 Jun 2011 08:45:30 -0400 Received: from eggs.gnu.org ([140.186.70.92]:40596) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QbB8m-0006b8-UN for qemu-devel@nongnu.org; Mon, 27 Jun 2011 08:42:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QbB8k-0004TA-PS for qemu-devel@nongnu.org; Mon, 27 Jun 2011 08:42:12 -0400 Received: from mel.act-europe.fr ([194.98.77.210]:40670) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QbB8k-0004SS-8d for qemu-devel@nongnu.org; Mon, 27 Jun 2011 08:42:10 -0400 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id BD06ACB023D for ; Mon, 27 Jun 2011 14:41:57 +0200 (CEST) X-Virus-Scanned: amavisd-new at eu.adacore.com Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vH9LRv+NQtuE for ; Mon, 27 Jun 2011 14:41:54 +0200 (CEST) Received: from PomPomGalli.act-europe.fr (pompomgalli.act-europe.fr [10.10.1.88]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id B88C5CB01F2 for ; Mon, 27 Jun 2011 14:41:54 +0200 (CEST) From: Fabien Chouteau To: qemu-devel@nongnu.org Date: Mon, 27 Jun 2011 14:41:51 +0200 Message-Id: <1309178511-20027-1-git-send-email-chouteau@adacore.com> X-Mailer: git-send-email 1.7.4.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 194.98.77.210 Subject: [Qemu-devel] [PATCH] Make SLIRP Ethernet packets size to 64 bytes minimum X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Fabien Chouteau --- slirp/slirp.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/slirp/slirp.c b/slirp/slirp.c index 1593be1..be30501 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)); } }