From: "Zhai, Edwin" <edwin.zhai@intel.com>
To: qemu-devel@nongnu.org
Cc: "Zhai, Edwin" <edwin.zhai@intel.com>
Subject: [Qemu-devel] bug in pcnet patch?
Date: Mon, 05 Sep 2005 17:10:32 +0800 [thread overview]
Message-ID: <431C0B88.4060303@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 584 bytes --]
hi,
i have found that guest and host can't communicate with each other with
pcnet patch, but ne2000 is okey.
(http://dad-answers.com/qemu/patches/AMD-PCNET-II/qemu-pcnet.patch6.gz)
reproduce steps --
use attached qemu-ifup and do a "ifconfig eth0 172.20.0.2 up" in guest
after boot. the ping between guest and host doesn't work.
root cause is that arp packet from tun interface (42 bytes) is small
than the minimal size(60 bytes) and is droped by guest pcnet driver.
attached patch(borrowed from ne2000) just expend the packet when size < 60.
any comments?
thanks,
edwin
[-- Attachment #2: qemu-ifup --]
[-- Type: text/plain, Size: 135 bytes --]
#!/bin/sh
echo $*
#test for pcnet's bug
ifconfig $1 172.20.0.1 up
route add -net 172.20.0.0 netmask 255.255.0.0 gw 172.20.0.1 dev $1
[-- Attachment #3: pcnet_fix.patch --]
[-- Type: text/x-patch, Size: 820 bytes --]
--- a/hw/pcnet.c Thu Sep 1 21:30:51 2005
+++ b/hw/pcnet.c Mon Sep 5 09:55:33 2005
@@ -380,10 +380,13 @@
return sizeof(s->buffer)-16;
}
+#define MIN_BUF_SIZE 60
+
static void pcnet_receive(void *opaque, const uint8_t *buf, int size)
{
PCNetState *s = opaque;
int is_padr = 0, is_bcast = 0, is_ladr = 0;
+ uint8_t buf1[60];
if (CSR_DRX(s) || CSR_STOP(s) || CSR_SPND(s) || !size)
return;
@@ -391,6 +394,14 @@
#ifdef PCNET_DEBUG
printf("pcnet_receive size=%d\n", size);
#endif
+
+ /* if too small buffer, then expand it */
+ if (size < MIN_BUF_SIZE) {
+ memcpy(buf1, buf, size);
+ memset(buf1 + size, 0, MIN_BUF_SIZE - size);
+ buf = buf1;
+ size = MIN_BUF_SIZE;
+ }
if (CSR_PROM(s)
|| (is_padr=padr_match(s, buf, size))
reply other threads:[~2005-09-05 9:16 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=431C0B88.4060303@intel.com \
--to=edwin.zhai@intel.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).