VMWare播放器和Ubuntu 15.04:网络驱动程序不再编译,如何修复?

我在Ubuntu上使用VMWare Player并在其上运行不同数量的虚拟机。

它工作正常,直到14.10,当内核升级时,我会被要求重新编译模块等; 但它不再适用于Ubuntu 15.04。

问题是它在尝试重新编译“虚拟网络适配器”时失败。 我该如何解决这个问题?

使用此命令(需要root访问权限):

$ wget http://pastie.org/pastes/9934018/download -O /tmp/vmnet-3.19.patch $ cd /usr/lib/vmware/modules/source $ tar -xf vmnet.tar $ patch -p0 -i /tmp/vmnet-3.19.patch $ tar -cf vmnet.tar vmnet-only $ rm -r *-only $ vmware-modconfig --console --install-all 

对于vmware-player 9,您还需要更改:

  • vmnet-only / netif.c第152行来自:

     dev = alloc_netdev(sizeof *netIf, deviceName, VNetNetIfSetup); 

     dev = alloc_netdev(sizeof *netIf, deviceName, NET_NAME_UNKNOWN, VNetNetIfSetup); 
  • vmnet-only / filter.c第207行来自:

    VNetFilterHookFn(unsigned int hooknum, // IN:

    至:

    VNetFilterHookFn(const struct nf_hook_ops *ops, // IN:

  • vmnet-only / filter.c第255行来自:

    transmit = (hooknum == VMW_NF_INET_POST_ROUTING);

    至:

    transmit = (ops->hooknum == VMW_NF_INET_POST_ROUTING);

这是因为Ubuntu 15.04使用Linux内核3.19,它改变了VMWare播放器尚未解决的网络API。

注意:此处使用的VMWare Player版本为7.1.x.

解决方案是将以下补丁应用于vmnet驱动程序:

 diff --git a/driver.cb/driver.c index 2e1e643..507a509 100644 --- a/driver.c +++ b/driver.c @@ -266,7 +266,7 @@ LinuxDriver_Ioctl32_Handler(unsigned int fd, // IN: (unused) int ret = -ENOTTY; if (filp && filp->f_op && filp->f_op->ioctl == VNetFileOpIoctl) { - ret = VNetFileOpIoctl(filp->f_dentry->d_inode, filp, iocmd, ioarg); + ret = VNetFileOpIoctl(filp->f_path.dentry->d_inode, filp, iocmd, ioarg); } return ret; } @@ -1191,8 +1191,8 @@ VNetFileOpUnlockedIoctl(struct file *filp, // IN: struct inode *inode = NULL; long err; - if (filp && filp->f_dentry) { - inode = filp->f_dentry->d_inode; + if (filp && filp->f_path.dentry) { + inode = filp->f_path.dentry->d_inode; } err = VNetFileOpIoctl(inode, filp, iocmd, ioarg); return err; diff --git a/userif.cb/userif.c index e68d4ce..b311f48 100644 --- a/userif.c +++ b/userif.c @@ -523,7 +523,9 @@ VNetCopyDatagram(const struct sk_buff *skb, // IN: skb to copy .iov_base = buf, .iov_len = len, }; - return skb_copy_datagram_iovec(skb, 0, &iov, len); + struct iov_iter to; + iov_iter_init(&to, READ, &iov, 1, len); + return skb_copy_datagram_iter(skb, 0, &to, len); } 

为了这:

  • 是根…
  • 在某处制作/usr/lib/vmware/modules/source/vmnet.tar的备份副本;
  • 在临时目录中解压缩;
  • 应用上面的补丁( cd vmnet-only && patch -p1 );
  • 重新创建tar存档,覆盖原始文件( tar cf /usr/lib/vmware/modules/source/vmnet.tar vmnet-only )。

然后,您可以重新启动VMWare播放器; 驱动程序将编译并安装。