Comment 1 for bug 1467240

Revision history for this message
Stefan Hajnoczi (stefanha) wrote : Re: [Qemu-devel] [Bug 1467240] [NEW] Regression - bridged networking broken for Mac OS X guest

On Sun, Jun 21, 2015 at 11:26:08AM -0000, Jonathan Liu wrote:
> Using the instructions at
> http://www.contrib.andrew.cmu.edu/~somlo/OSXKVM/ for running Mac OS X
> Snow Leopard under QEMU, bridged networking is broken when using QEMU
> git. The result is that Mac OS X is unable to obtain an IP address using
> DHCP. It works in the latest stable release - QEMU 2.3.0.
>
> Replace "-netdev user,id=hub0port0" with "-netdev
> bridge,br=br0,id=hub0port0" when testing bridged networking.
>
> Bisecting the git repository shows the following bad commit:
> commit a90a7425cf592a3afeff3eaf32f543b83050ee5c
> Author: Fam Zheng <email address hidden>
> Date: Thu Jun 4 14:45:17 2015 +0800
>
> tap: Drop tap_can_send

Please confirm that you are using -device e1000-82545em.

Please try the following patch to gather debug output:

diff --git a/hw/net/e1000.c b/hw/net/e1000.c
index bab8e2a..2f68c6d 100644
--- a/hw/net/e1000.c
+++ b/hw/net/e1000.c
@@ -174,6 +174,7 @@ enum {
 static void
 e1000_link_down(E1000State *s)
 {
+ fprintf(stderr, "%s link down\n", __func__);
     s->mac_reg[STATUS] &= ~E1000_STATUS_LU;
     s->phy_reg[PHY_STATUS] &= ~MII_SR_LINK_STATUS;
     s->phy_reg[PHY_STATUS] &= ~MII_SR_AUTONEG_COMPLETE;
@@ -183,6 +184,7 @@ e1000_link_down(E1000State *s)
 static void
 e1000_link_up(E1000State *s)
 {
+ fprintf(stderr, "%s link up\n", __func__);
     s->mac_reg[STATUS] |= E1000_STATUS_LU;
     s->phy_reg[PHY_STATUS] |= MII_SR_LINK_STATUS;
 }
@@ -923,6 +925,12 @@ e1000_can_receive(NetClientState *nc)
 {
     E1000State *s = qemu_get_nic_opaque(nc);

+ fprintf(stderr, "%s lu %d rctl_en %d pci_master %d has_rxbufs %d\n",
+ __func__, s->mac_reg[STATUS] & E1000_STATUS_LU,
+ s->mac_reg[RCTL] & E1000_RCTL_EN,
+ s->parent_obj.config[PCI_COMMAND] & PCI_COMMAND_MASTER,
+ e1000_has_rxbufs(s, 1));
+
     return (s->mac_reg[STATUS] & E1000_STATUS_LU) &&
         (s->mac_reg[RCTL] & E1000_RCTL_EN) &&
         (s->parent_obj.config[PCI_COMMAND] & PCI_COMMAND_MASTER) &&
diff --git a/net/tap.c b/net/tap.c
index bd01590..07676ce 100644
--- a/net/tap.c
+++ b/net/tap.c
@@ -67,6 +67,8 @@ static void tap_writable(void *opaque);

 static void tap_update_fd_handler(TAPState *s)
 {
+ fprintf(stderr, "%s read_poll %d write_poll %d enabled %d\n",
+ __func__, s->read_poll, s->write_poll, s->enabled);
     qemu_set_fd_handler(s->fd,
                         s->read_poll && s->enabled ? tap_send : NULL,
                         s->write_poll && s->enabled ? tap_writable : NULL,