VMware Workstation 12 and Centos 7

After I upgraded my Centos 7 box to kernel 3.10.0-693.2.2.el7.x86_64, VMware Workstation 12 spit this error out when trying to recompile the network modules:

compat_netdevice.h:343:46: error: ‘struct net_device’ has no member named ‘trans_start’

That's because the kernel just doesn't have trans_start anymore. So here's the fix:

mkdir ~/vmnet-fix
cd ~/vmnet-fix
cp /usr/lib/vmware/modules/source/vmnet.tar ./vmnet-12.5.7.tar
tar xf vmnet-12.5.7.tar
 

Open up your favorite text editor and make the file CentosVMwareWorkstation.patch with this content:

--- vmnet-only/compat_netdevice.h
+++ vmnet-only/compat_netdevice.h
@@ -337,7 +337,8 @@
 typedef u32 compat_netdev_features_t;
 #endif
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) || \
+    (defined(RHEL_RELEASE_CODE) && RHEL_RELEASE_CODE >= 0x0704)
 #define compat_netif_trans_update(d) netif_trans_update(d)
 #else
 #define compat_netif_trans_update(d) do { (d)->trans_start = jiffies; } while (0)

Save that and:

patch -p0 < CentosVMwareWorkstation.patch
tar cf vmnet.tar vmnet-only/
sudo cp vmnet.tar /usr/lib/vmware/modules/source/vmnet.tar
sudo vmware-modconfig --console --install-all

And then you're back in business.