VMware Communities
rgadsdon
Enthusiast
Enthusiast

Kernel 4.2 Breaks vmnet.. (again..)

VMware 11.1.2 vmnet fails to compile with host Kernel 4.2 (-rc1/2/3):

/tmp/modconfig-aJnfZl/vmnet-only/bridge.c: In function ‘VNetBridgeUp’:

/tmp/modconfig-aJnfZl/vmnet-only/bridge.c:952:17: error: too few arguments to function ‘sk_alloc’

bridge->sk = compat_sk_alloc(bridge, GFP_ATOMIC);

^

In file included from /tmp/modconfig-aJnfZl/vmnet-only/compat_sock.h:23:0,

from /tmp/modconfig-aJnfZl/vmnet-only/bridge.c:35:

include/net/sock.h:1515:14: note: declared here

struct sock *sk_alloc(struct net *net, int family, gfp_t priority,

^

scripts/Makefile.build:258: recipe for target '/tmp/modconfig-aJnfZl/vmnet-only/bridge.o' failed


Robert Gadsdon.  July 2015.

0 Kudos
9 Replies
craigacgomez
Contributor
Contributor

Just to be clear, I'm no expert in kernel level modifications... in fact, I am quite a noob in this area. But I did manage to workaround this in a super hacky way.

In vmnet, the compat_sk_alloc call in bridge.c essentially eventually calls include/net/sock.h sk_alloc as defined in vmnetInt.h

Now, in vmnetInt.h, this is how sk_alloc is called


extern struct proto vmnet_proto;

#ifdef VMW_NETDEV_HAS_NET

#  define compat_sk_alloc(_bri, _pri) sk_alloc(&init_net, \

                                                PF_NETLINK, _pri, &vmnet_proto)

#else

#  define compat_sk_alloc(_bri, _pri) sk_alloc(PF_NETLINK, _pri, &vmnet_proto, 1)

#endif

And for kernel 4.2rc1+, I made this change according to the method signature for sk_alloc in include/net/sock.h [struct sock *sk_alloc(struct net *net, int family, gfp_t priority, struct proto *prot, int kern]

extern struct proto vmnet_proto;

#ifdef VMW_NETDEV_HAS_NET

#  define compat_sk_alloc(_bri, _pri) sk_alloc(&init_net, \

                                                PF_NETLINK, _pri, &vmnet_proto, 1)

#else

#  define compat_sk_alloc(_bri, _pri) sk_alloc(PF_NETLINK, _pri, &vmnet_proto, 1)

#endif

And then ran sudo vmware-modconfig --console --install-all and everything compiled successfully.

Obviously, this is not an elegant solution and definitely not backward compatible. So hopefully, someone with more experience than me will be able to come up with a proper patch. This change works on 4.2rc1+ and I've had no issue yet!

0 Kudos
rgadsdon
Enthusiast
Enthusiast

Thanks..    I made the changes and it works fine on 4.2-rc4..

To make it backward-compatible, you could do something like:

#ifdef VMW_NETDEV_HAS_NET

#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 00)

#   define compat_sk_alloc(_bri, _pri) sk_alloc(&init_net, \

                                                PF_NETLINK, _pri, &vmnet_proto, 1)

#else

#   define compat_sk_alloc(_bri, _pri) sk_alloc(&init_net, \

                                                PF_NETLINK, _pri, &vmnet_proto)

#endif

#else

#   define compat_sk_alloc(_bri, _pri) sk_alloc(PF_NETLINK, _pri, &vmnet_proto, 1)

#endif


I should stress that I am not a professional coder!    I have tried this, and it appears to work OK with VMware 11.1.2 on Kernel 4.1.3 and 4.2-rc4..  

YMMV..  Usual disclaimer applies..


RG.

0 Kudos
smknjoe
Contributor
Contributor

I tried this on 4.2-rc6 and no luck. Any other suggestions?

0 Kudos
rt68
Contributor
Contributor

Try this:

In

vmnet-only/vmnetInt.h

change

#   define compat_sk_alloc(_bri, _pri) sk_alloc(&init_net, \

                                                PF_NETLINK, _pri, &vmnet_proto)

to

#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)

#   define compat_sk_alloc(_bri, _pri) sk_alloc(&init_net, \

                                                PF_NETLINK, _pri, &vmnet_proto)

#else

#   define compat_sk_alloc(_bri, _pri) sk_alloc(&init_net, \

                                                PF_NETLINK, _pri, &vmnet_proto, 1)

#endif

0 Kudos
smknjoe
Contributor
Contributor

The issue is fixed in Workstation 12.0 on kernel 4.2-rc8. I'll give your modules a try on another box if I don't upgrade to Workstation 12. Thanks for the help.

0 Kudos
mfelker
Expert
Expert

Archwiki says WS 12 Pro is compatible with kernel 4.2 rc8 (4.2 stable was released yesterday btw).  If people who installed it on that kernel were using gcc 5.2 I would reconsider updating to a WS 12 license - although the price is quite high.  Is this the case??

0 Kudos
raven009
Contributor
Contributor

Thanks a lot.

It helped me.

0 Kudos
illu
Contributor
Contributor

Hi,

Thanks, this is what i need!

You made my day Smiley Happy

regards

bernd

0 Kudos