From: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: 638955@bugs.launchpad.net,
Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>,
"Michael S. Tsirkin" <mst@redhat.com>
Subject: [Qemu-devel] [PATCH] e1000: Pad short frames to minimum size (60 bytes)
Date: Sat, 18 Sep 2010 21:43:45 +0100 [thread overview]
Message-ID: <1284842625-13920-1-git-send-email-stefanha@linux.vnet.ibm.com> (raw)
The OpenIndiana (Solaris) e1000g driver drops frames that are too long
or too short. It expects to receive frames of at least the Ethernet
minimum size. ARP requests in particular are small and will be dropped
if they are not padded appropriately, preventing a Solaris VM from
becoming visible on the network.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
hw/e1000.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/hw/e1000.c b/hw/e1000.c
index 7d7d140..bc983f9 100644
--- a/hw/e1000.c
+++ b/hw/e1000.c
@@ -55,6 +55,7 @@ static int debugflags = DBGBIT(TXERR) | DBGBIT(GENERAL);
#define IOPORT_SIZE 0x40
#define PNPMMIO_SIZE 0x20000
+#define MIN_BUF_SIZE 60
/*
* HW models:
@@ -635,10 +636,19 @@ e1000_receive(VLANClientState *nc, const uint8_t *buf, size_t size)
uint32_t rdh_start;
uint16_t vlan_special = 0;
uint8_t vlan_status = 0, vlan_offset = 0;
+ uint8_t min_buf[MIN_BUF_SIZE];
if (!(s->mac_reg[RCTL] & E1000_RCTL_EN))
return -1;
+ /* Pad to minimum Ethernet frame length */
+ if (size < sizeof(min_buf)) {
+ memcpy(min_buf, buf, size);
+ memset(&min_buf[size], 0, sizeof(min_buf) - size);
+ buf = min_buf;
+ size = sizeof(min_buf);
+ }
+
if (size > s->rxbuf_size) {
DBGOUT(RX, "packet too large for buffers (%lu > %d)\n",
(unsigned long)size, s->rxbuf_size);
--
1.7.1
next reply other threads:[~2010-09-18 20:44 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-18 20:43 Stefan Hajnoczi [this message]
2010-09-18 20:57 ` [Qemu-devel] [PATCH] e1000: Pad short frames to minimum size (60 bytes) Hervé Poussineau
2010-09-18 21:12 ` Stefan Hajnoczi
2010-09-20 8:42 ` Kevin Wolf
2010-09-20 8:51 ` Edgar E. Iglesias
2010-09-20 9:13 ` Stefan Hajnoczi
2010-09-18 21:27 ` Edgar E. Iglesias
2010-09-19 6:36 ` Stefan Hajnoczi
2010-09-19 11:18 ` Michael S. Tsirkin
2010-09-19 12:04 ` Edgar E. Iglesias
2010-09-19 12:03 ` Michael S. Tsirkin
2010-09-20 8:50 ` Kevin Wolf
2010-09-20 9:03 ` Edgar E. Iglesias
2010-09-20 9:34 ` Stefan Hajnoczi
2010-09-20 10:42 ` Michael S. Tsirkin
2010-09-20 20:31 ` Anthony Liguori
2010-09-20 20:35 ` Michael S. Tsirkin
2010-09-20 20:40 ` Edgar E. Iglesias
2010-09-20 20:44 ` Michael S. Tsirkin
2010-09-20 20:51 ` [Bug 638955] " Edgar E. Iglesias
2010-09-21 9:17 ` Michael S. Tsirkin
2010-09-21 9:21 ` Edgar E. Iglesias
2010-09-21 9:16 ` [Bug 638955] " Stefan Hajnoczi
2011-02-21 21:13 ` [Qemu-devel] " Stefan Weil
2010-09-20 17:52 ` [Qemu-devel] Re: [PATCH] e1000: " Michael S. Tsirkin
-- strict thread matches above, loose matches on Subject: below --
2010-09-15 13:29 [Qemu-devel] [Bug 638955] [NEW] emulated netcards don't work with recent sunos kernel daniel pecka
2010-09-17 8:47 ` [Qemu-devel] [Bug 638955] " daniel pecka
2010-09-17 15:52 ` daniel pecka
2010-09-20 8:02 ` daniel pecka
2010-09-20 9:47 ` Stefan Hajnoczi
2010-09-20 20:57 ` [Bug 638955] Re: [Qemu-devel] [PATCH] e1000: Pad short frames to minimum size (60 bytes) Anthony Liguori
2010-09-20 21:02 ` Edgar E. Iglesias
2010-09-21 8:49 ` [Qemu-devel] [Bug 638955] Re: emulated netcards don't work with recent sunos kernel daniel pecka
2010-10-02 19:23 ` daniel pecka
2010-10-12 14:40 ` [Qemu-devel] " Stefan Hajnoczi
2011-01-03 13:40 ` [Qemu-devel] " daniel pecka
2011-01-04 9:36 ` [Qemu-devel] " Stefan Hajnoczi
2011-01-04 10:04 ` [Qemu-devel] " daniel pecka
2011-01-04 17:51 ` Stefan Weil
2011-01-29 17:41 ` Daniel Kvasnicka
2011-02-28 19:06 ` geppz
2011-03-01 9:50 ` [Qemu-devel] " Stefan Hajnoczi
2011-03-01 15:14 ` [Qemu-devel] " geppz
2011-03-05 20:14 ` Stefan Hajnoczi
2011-03-06 12:32 ` Stefan Hajnoczi
2011-03-07 18:43 ` geppz
2014-10-05 20:57 ` dblade
2014-10-06 8:53 ` Stefan Hajnoczi
2014-10-07 1:46 ` dblade
2015-09-08 22:14 ` Jan Vlug
2015-09-10 19:44 ` Jan Vlug
2016-08-12 4:58 ` T. Huth
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=1284842625-13920-1-git-send-email-stefanha@linux.vnet.ibm.com \
--to=stefanha@linux.vnet.ibm.com \
--cc=638955@bugs.launchpad.net \
--cc=mst@redhat.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).