Reply to Message

View discussion in a popup

Replying to:
nikjoesta
Contributor
Contributor

Cannot compile vmnet kernel module on kernel 6.4.10

Problem

Building of vmnet module fails in newer kernel versions. For me it failed in kernel version 6.4.10-arch1-1. (Yes I use Archlinux)

I compiled with: 

 

vmware-modconfig --console --install-all

 

I got:

 

/tmp/modconfig-7XKYCP/vmnet-only/bridge.c: In function ‘VNetBridgeSendLargePacket’:
/tmp/modconfig-7XKYCP/vmnet-only/bridge.c:1413:11: error: implicit declaration of function ‘skb_gso_segment’; did you mean ‘tcp_gso_segment’? [-Werror=implicit-function-declaration]
1413 | segs = skb_gso_segment(skb, 0);
| ^~~~~~~~~~~~~~~
| tcp_gso_segment
/tmp/modconfig-7XKYCP/vmnet-only/bridge.c:1413:9: warning: assignment to ‘struct sk_buff *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
1413 | segs = skb_gso_segment(skb, 0);
| ^
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:252: /tmp/modconfig-7XKYCP/vmnet-only/bridge.o] Error 1
make[1]: *** [Makefile:2032: /tmp/modconfig-7XKYCP/vmnet-only] Error 2
make: *** [Makefile:117: vmnet.ko] Error 2
make: Leaving directory '/tmp/modconfig-7XKYCP/vmnet-only'
Unable to install all modules. See log for details.

 

Analysis

I figured out that in Linux kernel commit https://github.com/torvalds/linux/commit/d457a0e329b0bfd3a1450e0b1a18cd2b47a25a08 there was a change.

They moved code (including the function skb_gso_segment) from one "header" to another (<linux/inetdevice.h> to <net/gso.h>).

Commit message: "Move declarations into include/net/gso.h and code into net/core/gso.c"

Solution

In bridge.c one needs to add #include <net/gso.h>

How? I bet You are lazy... Assuming You have installed the .bundle and just want to compile... Try this:

 

# Cd to te dir where the vmware modules are.
cd /usr/lib/vmware/modules/source
# Unpack vmnet.
tar -xvf vmnet.tar
# Add the missing include (code is just there now)
sed -i '46 a#include <net/gso.h>' vmnet-only/bridge.c
# Backup original vmnet.tar
mv vmnet.tar vmnet.tar.original
# Pack the patched vmnet.
tar -cf vmnet.tar vmnet-only

 

Now if you are running

 

vmware-modconfig --console --install-all

 

again everything should work.

Disclaimer

Since it is a real pain to let You vmware guys know of a bug. I at least try to help people here. I couldn't figure a way to send You this...

Hope this helps ‌‌:grinning_face: