summarylogtreecommitdiffstats
path: root/vmnet.patch
diff options
context:
space:
mode:
Diffstat (limited to 'vmnet.patch')
-rw-r--r--vmnet.patch609
1 files changed, 529 insertions, 80 deletions
diff --git a/vmnet.patch b/vmnet.patch
index ae2b7a0baebb..6095bd3ea237 100644
--- a/vmnet.patch
+++ b/vmnet.patch
@@ -1,6 +1,6 @@
--- a/vmnet/Makefile
+++ b/vmnet/Makefile
-@@ -43,7 +43,11 @@ INCLUDE += -I$(SRCROOT)/shared
+@@ -43,7 +43,11 @@
endif
@@ -37,7 +37,26 @@
MODULEBUILDDIR=$(MODULEBUILDDIR) postbuild
--- a/vmnet/bridge.c
+++ b/vmnet/bridge.c
-@@ -636,7 +636,7 @@
+@@ -26,6 +26,9 @@
+ #include <linux/slab.h>
+ #include <linux/poll.h>
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 10)
++#include <net/gso.h>
++#endif
+ #include <linux/netdevice.h>
+ #include <linux/etherdevice.h>
+ #include <linux/mm.h>
+@@ -65,7 +65,7 @@
+ #endif
+
+ #if LOGLEVEL >= 4
+-static struct timeval vnetTime;
++static u64 vnetTime;
+ #endif
+
+ typedef struct VNetBridge VNetBridge;
+@@ -636,7 +636,7 @@ VNetBridgeReceiveFromVNet(VNetJack
unsigned long flags;
int i;
@@ -46,7 +65,30 @@
clone->dev = dev;
clone->protocol = eth_type_trans(clone, dev);
-@@ -1143,11 +1143,16 @@
+@@ -687,16 +687,13 @@
+ }
+ spin_unlock_irqrestore(&bridge->historyLock, flags);
+
+- /*
+- * We used to cli() before calling netif_rx() here. It was probably
+- * unneeded (as we never did it in netif.c, and the code worked). In
+- * any case, now that we are using netif_rx_ni(), we should certainly
+- * not do it, or netif_rx_ni() will deadlock on the cli() lock --hpreg
+- */
+-
+- netif_rx_ni(clone);
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0)
++ netif_rx_ni(clone);
++#else
++ netif_rx(clone);
++#endif
+ # if LOGLEVEL >= 4
+- do_gettimeofday(&vnetTime);
++ vnetTime = ktime_get_ns();
+ # endif
+ }
+ }
+@@ -1143,11 +1143,16 @@ VNetBridgeNotifyLogBridgeUpError(int err
static int
VNetBridgeNotify(struct notifier_block *this, // IN: callback data (bridge)
u_long msg, // IN: type of event
@@ -65,9 +107,26 @@
switch (msg) {
case NETDEV_UNREGISTER:
LOG(2, (KERN_DEBUG "bridge-%s: interface %s is unregistering\n",
+@@ -1656,12 +1661,11 @@ VNetBridgeReceiveFromDev(struct sk_buff
+
+ # if LOGLEVEL >= 4
+ {
+- struct timeval now;
+- do_gettimeofday(&now);
++ u64 now;
++
++ now = ktime_get_ns();
+ LOG(3, (KERN_DEBUG "bridge-%s: time %d\n",
+- bridge->name,
+- (int)((now.tv_sec * 1000000 + now.tv_usec)
+- - (vnetTime.tv_sec * 1000000 + vnetTime.tv_usec))));
++ bridge->name, (int)((now - vnetTime) / NSEC_PER_USEC)));
+ }
+ # endif
+
--- a/vmnet/compat_netdevice.h
+++ b/vmnet/compat_netdevice.h
-@@ -337,4 +337,11 @@
+@@ -337,4 +337,11 @@ typedef netdev_features_t compat_netdev_
typedef u32 compat_netdev_features_t;
#endif
@@ -79,9 +138,53 @@
+#endif
+
#endif /* __COMPAT_NETDEVICE_H__ */
+--- a/vmnet/driver.c
++++ b/vmnet/driver.c
+@@ -279,7 +279,7 @@
+ /*
+ *----------------------------------------------------------------------
+ *
+- * init_module --
++ * LinuxDriverInit --
+ *
+ * linux module entry point. Called by /sbin/insmod command.
+ * Initializes module and Registers this driver for a
+@@ -296,7 +296,7 @@
+ */
+
+ int
+-init_module(void)
++LinuxDriverInit(void)
+ {
+ int retval;
+
+@@ -358,7 +358,7 @@
+ /*
+ *----------------------------------------------------------------------
+ *
+- * cleanup_module --
++ * LinuxDriverExit --
+ *
+ * Called by /sbin/rmmod. Unregisters this driver for a
+ * vnet major #, and deinitializes the modules. The 64-bit
+@@ -375,7 +375,7 @@
+ */
+
+ void
+-cleanup_module(void)
++LinuxDriverExit(void)
+ {
+ unregister_chrdev(VNET_MAJOR_NUMBER, "vmnet");
+ VNetProtoUnregister();
+@@ -1705,3 +1705,5 @@
+ * by default (i.e., neither mkinitrd nor modprobe will accept it).
+ */
+ MODULE_INFO(supported, "external");
++module_init(LinuxDriverInit);
++module_exit(LinuxDriverExit);
--- a/vmnet/netif.c
+++ b/vmnet/netif.c
-@@ -149,7 +149,7 @@
+@@ -149,7 +149,7 @@ VNetNetIf_Create(char *devName, // IN:
memcpy(deviceName, devName, sizeof deviceName);
NULL_TERMINATE_STRING(deviceName);
@@ -90,7 +193,31 @@
dev = alloc_netdev(sizeof *netIf, deviceName, NET_NAME_USER, VNetNetIfSetup);
#else
dev = alloc_netdev(sizeof *netIf, deviceName, VNetNetIfSetup);
-@@ -465,7 +465,7 @@
+@@ -219,7 +219,11 @@
+
+ memset(&netIf->stats, 0, sizeof netIf->stats);
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0)
+ memcpy(dev->dev_addr, netIf->port.paddr, sizeof netIf->port.paddr);
++#else
++ eth_hw_addr_set(dev, netIf->port.paddr);
++#endif
+
+ if (register_netdev(dev) != 0) {
+ LOG(0, (KERN_NOTICE "%s: could not register network device\n",
+@@ -311,7 +315,11 @@
+ /* send to the host interface */
+ skb->dev = netIf->dev;
+ skb->protocol = eth_type_trans(skb, netIf->dev);
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0)
+ netif_rx_ni(skb);
++#else
++ netif_rx(skb);
++#endif
+ netIf->stats.rx_packets++;
+
+ return;
+@@ -465,7 +465,7 @@ VNetNetifStartXmit(struct sk_buff *sk
VNetSend(&netIf->port.jack, skb);
netIf->stats.tx_packets++;
@@ -99,6 +226,72 @@
return 0;
}
+@@ -498,7 +506,11 @@
+ return -EINVAL;
+ }
+ memcpy(netIf->port.paddr, addr->sa_data, dev->addr_len);
+- memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0)
++ memcpy(dev->dev_addr, netIf->port.paddr, dev->addr_len);
++#else
++ eth_hw_addr_set(dev, netIf->port.paddr);
++#endif
+ return 0;
+ }
+
+--- a/vmnet/procfs.c
++++ a/vmnet/procfs.c
+@@ -137,6 +137,7 @@ VNetProcShow(struct seq_file *p, // IN:
+ }
+
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 18, 0)
+ /*
+ *----------------------------------------------------------------------
+ *
+@@ -168,6 +169,7 @@ static struct file_operations fops = {
+ .release = single_release,
+ };
+ #endif
++#endif
+
+
+ /*
+@@ -203,7 +205,12 @@ VNetProcMakeEntryInt(VNetProcEntry *pa
+ } else {
+ ent->data = data;
+ ent->fn = fn;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0)
++ ent->pde = proc_create_single_data(name, mode, parent->pde,
++ VNetProcShow, ent);
++#else
+ ent->pde = proc_create_data(name, mode, parent->pde, &fops, ent);
++#endif
+ }
+ if (ent->pde != NULL) {
+ *ret = ent;
+--- a/vmnet/smac.c
++++ b/vmnet/smac.c
+@@ -4115,7 +4115,7 @@
+
+ void SMACINT
+ SMAC_SetMac(SMACState *state, // IN: state to update
+- uint8 *mac) // IN: pointer to host adapter's MAC
++ const uint8 *mac) // IN: pointer to host adapter's MAC
+ {
+ VNETKdPrintCall(("SMAC_SetMac"));
+ ASSERT(state);
+--- a/vmnet/smac.h
++++ b/vmnet/smac.h
+@@ -72,7 +72,7 @@
+ void SMACINT
+ SMAC_InitState(struct SMACState **ptr); // IN: state to alloc/init
+ void SMACINT
+-SMAC_SetMac(struct SMACState *state, uint8 *mac); // IN: state, and host MAC
++SMAC_SetMac(struct SMACState *state, const uint8 *mac); // IN: state, and host MAC
+ void SMACINT
+ SMAC_CleanupState(struct SMACState **ptr); // IN: state to cleanup/dealloc
+
--- a/vmnet/userif.c
+++ b/vmnet/userif.c
@@ -36,6 +36,9 @@
@@ -111,7 +304,24 @@
#include <net/checksum.h>
#include <net/sock.h>
-@@ -112,10 +113,7 @@
+@@ -81,11 +84,11 @@ static int VNetUserIfSetUplinkState(VNe
+ extern unsigned int vnet_max_qlen;
+
+ #if COMPAT_LINUX_VERSION_CHECK_LT(3, 2, 0)
+-# define compat_kmap(page) kmap(page)
+-# define compat_kunmap(page) kunmap(page)
+-#else
+-# define compat_kmap(page) kmap((page).p)
+-# define compat_kunmap(page) kunmap((page).p)
++# define skb_frag_page(frag) (frag)->page
++# define skb_frag_size(frag) (frag)->size
++#endif
++#if COMPAT_LINUX_VERSION_CHECK_LT(5, 4, 0)
++# define skb_frag_off(frag) (frag)->page_offset
+ #endif
+
+ /*
+@@ -112,10 +115,7 @@ UserifLockPage(VA addr) // IN
struct page *page = NULL;
int retval;
@@ -123,7 +333,7 @@
if (retval != 1) {
return NULL;
-@@ -143,16 +143,21 @@
+@@ -143,16 +143,21 @@ UserifLockPage(VA addr) // IN
*/
static INLINE int
@@ -149,7 +359,7 @@
*p = UserifLockPage(uAddr);
if (*p == NULL) {
-@@ -164,7 +169,7 @@
+@@ -164,7 +169,7 @@ VNetUserIfMapPtr(VA uAddr, // IN:
}
static INLINE int
@@ -158,7 +368,7 @@
struct page **p, // OUT: locked page
uint32 **ptr) // OUT: kernel mapped pointer
{
-@@ -209,7 +214,7 @@
+@@ -209,7 +214,7 @@ VNetUserIfSetupNotify(VNetUserIF *userIf
return -EBUSY;
}
@@ -167,7 +377,7 @@
&pollPtr)) < 0) {
return retval;
}
-@@ -227,7 +232,7 @@
+@@ -227,7 +232,7 @@ VNetUserIfSetupNotify(VNetUserIF *userIf
goto error_free;
}
@@ -176,80 +386,72 @@
&recvClusterPage,
&recvClusterCount)) < 0) {
goto error_free;
---- a/vmnet/vmnetInt.h
-+++ b/vmnet/vmnetInt.h
-@@ -77,7 +77,7 @@
-
-
- extern struct proto vmnet_proto;
--#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) || defined(sk_net_refcnt)
- # define compat_sk_alloc(_bri, _pri) sk_alloc(&init_net, \
- PF_NETLINK, _pri, &vmnet_proto, 1)
- #elif defined(VMW_NETDEV_HAS_NET)
-From f404bc6855ea2c731b617d3b0a2971481eb31cbd Mon Sep 17 00:00:00 2001
-From: Michal Kubecek <mkubecek@suse.cz>
-Date: Thu, 19 Sep 2019 12:20:20 +0200
-Subject: [PATCH] vmnet: handle switch of skb_frag_t to bio_vec
-
-The switch from custom skb_frag_t implementation to bio_vec in v5.4-rc1 is
-mostly transparent for modules which use accessor for skb_frag_t members.
-Unfortunately many users access the members directly and function
-VNetCsumCopyDatagram() in vmnet is one of those.
-
-Use accessors everywhere so that vmnet code is compatible with kernel 5.4
-and newer. Use "compat_" prefix to avoid clashes with backports adding the
-accessors to older codebase.
----
- vmnet-only/userif.c | 39 +++++++++++++++++++++++++++++----------
- 1 file changed, 29 insertions(+), 10 deletions(-)
-
-diff --git a/vmnet-only/userif.c b/vmnet-only/userif.c
-index d385088..aab9478 100644
---- a/vmnet-only/userif.c
-+++ b/vmnet-only/userif.c
-@@ -84,13 +84,31 @@ static int VNetUserIfSetUplinkState(VNetPort *port, uint8 linkUp);
- extern unsigned int vnet_max_qlen;
-
- #if COMPAT_LINUX_VERSION_CHECK_LT(3, 2, 0)
--# define compat_kmap(page) kmap(page)
--# define compat_kunmap(page) kunmap(page)
-+# define compat_kmap_frag(frag) kmap((frag)->page)
-+# define compat_kunmap_frag(page) kunmap((frag)->page)
- #else
--# define compat_kmap(page) kmap((page).p)
--# define compat_kunmap(page) kunmap((page).p)
-+# define compat_kmap_frag(frag) kmap(skb_frag_page(frag))
-+# define compat_kunmap_frag(frag) kunmap(skb_frag_page(frag))
- #endif
-
-+static unsigned int compat_skb_frag_size(const skb_frag_t *frag)
-+{
-+#if COMPAT_LINUX_VERSION_CHECK_LT(3, 2, 0)
-+ return frag->size;
-+#else
-+ return skb_frag_size(frag);
-+#endif
-+}
+@@ -537,6 +542,50 @@
+ /*
+ *----------------------------------------------------------------------
+ *
++ * VNetCsumAndCopyToUser --
++ *
++ * Checksum data and copy them to userspace.
++ *
++ * Results:
++ * folded checksum (non-zero value) on success,
++ * err set to 0 on success, negative errno on failure.
++ *
++ * Side effects:
++ * Data copied to the buffer.
++ *
++ *----------------------------------------------------------------------
++ */
+
-+static unsigned int compat_skb_frag_off(const skb_frag_t *frag)
++static unsigned int
++VNetCsumAndCopyToUser(const void *src, // IN: Source
++ void *dst, // IN: Destination
++ int len, // IN: Bytes to copy
++ int *err) // OUT: Error code
+{
-+#if COMPAT_LINUX_VERSION_CHECK_LT(5, 4, 0)
-+ return frag->page_offset;
++ unsigned int csum;
++
++#if COMPAT_LINUX_VERSION_CHECK_LT(5, 10, 0)
++ csum = csum_and_copy_to_user(src, dst, len, 0, err);
++#elif LINUX_VERSION_CODE < KERNEL_VERSION(5, 19, 0)
++ csum = csum_and_copy_to_user(src, dst, len);
++ *err = (csum == 0) ? -EFAULT : 0;
+#else
-+ return skb_frag_off(frag);
++ if (!user_access_begin(dst, len)) {
++ *err = -EFAULT;
++ csum = 0;
++ } else {
++ *err = 0;
++ csum = csum_partial_copy_nocheck(src, dst, len);
++ user_access_end();
++ }
+#endif
++ return csum;
+}
+
- /*
- *-----------------------------------------------------------------------------
++
++/*
++ *----------------------------------------------------------------------
++ *
+ * VNetCsumCopyDatagram --
*
-@@ -590,20 +608,21 @@ VNetCsumCopyDatagram(const struct sk_buff *skb, // IN: skb to copy
+ * Copy part of datagram to userspace doing checksum at same time.
+@@ -576,7 +581,7 @@ VNetCsumCopyDatagram(const struct sk_buf
+ return -EINVAL;
+ }
+
+- csum = csum_and_copy_to_user(skb->data + offset, curr, len, 0, &err);
++ csum = VNetCsumAndCopyToUser(skb->data + offset, curr, len, &err);
+ if (err) {
+ return err;
+ }
+@@ -585,20 +595,20 @@ VNetCsumCopyDatagram(const struct sk_buf
for (frag = skb_shinfo(skb)->frags;
frag != skb_shinfo(skb)->frags + skb_shinfo(skb)->nr_frags;
frag++) {
- if (frag->size > 0) {
-+ if (compat_skb_frag_size(frag) > 0) {
++ if (skb_frag_size(frag) > 0) {
unsigned int tmpCsum;
const void *vaddr;
@@ -257,18 +459,265 @@ index d385088..aab9478 100644
- tmpCsum = csum_and_copy_to_user(vaddr + frag->page_offset,
- curr, frag->size, 0, &err);
- compat_kunmap(frag->page);
-+ vaddr = compat_kmap_frag(frag);
-+ tmpCsum = csum_and_copy_to_user(vaddr + compat_skb_frag_off(frag),
-+ curr, compat_skb_frag_size(frag), 0,
-+ &err);
-+ compat_kunmap_frag(frag);
++ vaddr = kmap(skb_frag_page(frag));
++ tmpCsum = VNetCsumAndCopyToUser(vaddr + skb_frag_off(frag),
++ curr, skb_frag_size(frag), &err);
++ kunmap(skb_frag_page(frag));
if (err) {
return err;
}
csum = csum_block_add(csum, tmpCsum, curr - buf);
- curr += frag->size;
-+ curr += compat_skb_frag_size(frag);
++ curr += skb_frag_size(frag);
}
}
+Fixing VMWare Player on Linux when using DHCP addresses: https://www.nikhef.nl/~janjust/vmnet/
+@@ -1012,6 +1028,9 @@
+ userIf = (VNetUserIF *)port->jack.private;
+ hubJack = port->jack.peer;
+
++ /* never send link down events */
++ if (!linkUp) return 0;
++
+ if (port->jack.state == FALSE || hubJack == NULL) {
+ return -EINVAL;
+ }
+--- a/vmnet/vmnetInt.h
++++ b/vmnet/vmnetInt.h
+@@ -77,7 +77,7 @@
+
+
+ extern struct proto vmnet_proto;
+-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) || defined(sk_net_refcnt)
+ # define compat_sk_alloc(_bri, _pri) sk_alloc(&init_net, \
+ PF_NETLINK, _pri, &vmnet_proto, 1)
+ #elif defined(VMW_NETDEV_HAS_NET)
+--- a/vmnet/vnetEvent.c
++++ b/vmnet/vnetEvent.c
+@@ -60,10 +60,12 @@
+
+ struct VNetEvent_EventNode {
+ VNetEvent_EventNode *nextEvent;
+- VNet_EventHeader event;
++ union {
++ VNet_EventHeader header;
++ VNet_LinkStateEvent lse;
++ } event;
+ };
+
+-#define EVENT_NODE_HEADER_SIZE offsetof(struct VNetEvent_EventNode, event)
+
+ struct VNetEvent_Mechanism {
+ VNetKernel_SpinLock lock; /* mechanism lock */
+@@ -369,6 +371,10 @@
+ return VNetKernel_EINVAL;
+ }
+
++ if (e->size > sizeof(p->event)) {
++ return VNetKernel_EINVAL;
++ }
++
+ /* lock */
+ VNetKernel_SpinLockAcquire(&m->lock);
+ m->handlerTask = VNetKernel_ThreadCurrent();
+@@ -378,22 +384,15 @@
+ while (TRUE) {
+ p = *q;
+ if (p == NULL ||
+- (p->event.eventId == e->eventId && p->event.type == e->type)) {
++ (p->event.header.eventId == e->eventId && p->event.header.type == e->type)) {
+ break;
+ }
+ q = &p->nextEvent;
+ }
+
+- /* remove previously sent event */
+- if (p != NULL && p->event.size != e->size) {
+- *q = p->nextEvent;
+- VNetKernel_MemoryFree(p);
+- p = NULL;
+- }
+-
+ /* insert new event into event list*/
+ if (p == NULL) {
+- p = VNetKernel_MemoryAllocate(EVENT_NODE_HEADER_SIZE + e->size);
++ p = VNetKernel_MemoryAllocate(sizeof(*p));
+ if (p == NULL) {
+ m->handlerTask = NULL;
+ VNetKernel_SpinLockRelease(&m->lock);
+@@ -485,8 +484,8 @@
+ while (s != NULL) {
+ e = s->firstEvent;
+ while (e != NULL) {
+- if ((e->event.classSet & classMask) != 0) {
+- h(data, &e->event);
++ if ((e->event.header.classSet & classMask) != 0) {
++ h(data, &e->event.header);
+ }
+ e = e->nextEvent;
+ }
+--- a/vmnet/vnetUserListener.c
+--- b/vmnet/vnetUserListener.c
+@@ -42,10 +42,12 @@
+
+ struct VNetUserListener_EventNode {
+ VNetUserListener_EventNode *nextEvent;
+- VNet_EventHeader event;
++ union {
++ VNet_EventHeader header;
++ VNet_LinkStateEvent lse;
++ } event;
+ };
+
+-#define EVENT_NODE_HEADER_SIZE offsetof(struct VNetUserListener_EventNode, event)
+
+ typedef struct VNetUserListener {
+ VNetPort port; /* base port/jack */
+@@ -220,7 +222,7 @@
+ VNetUserListener_EventNode *t;
+
+ /* allocate and initialize event node */
+- t = kmalloc(EVENT_NODE_HEADER_SIZE + e->size, GFP_ATOMIC);
++ t = kmalloc(sizeof *t, GFP_ATOMIC);
+ if (t == NULL) {
+ LOG(0, (KERN_DEBUG "VNetUserListenerEventHandler, out of memory\n"));
+ return;
+@@ -299,7 +301,7 @@
+ spin_unlock(&userListener->lock);
+
+ /* return data and free event */
+- n = t->event.size;
++ n = t->event.header.size;
+ if (count < n) {
+ n = count;
+ }
+From add7a6d8b99565fdfa79098315b0a69fd244eda3 Mon Sep 17 00:00:00 2001
+From: Michal Kubecek <mkubecek@suse.cz>
+Date: Fri, 12 Jan 2024 08:30:33 +0100
+Subject: [PATCH] modules: fix build with -Wmissing-prototypes
+
+Mainline commit 0fcb70851fbf ("Makefile.extrawarn: turn on
+missing-prototypes globally") in 6.8-rc1 enables -Wmissing-prototypes
+globally, revealing a lot of unclean code and also some actual problems.
+This is also the case in vmmon and vmnet modules.
+
+Most of them are addressed by making functions used only within one file
+static. A special case are Vmx86_MapPage() and Vmx86_UnmapPage() which were
+defined since Workstation 14.0.0 but they are not actually used anywhere
+until 15.0.0 so that dropping them seems to be the best option.
+
+The missing prototype of random_get_entropy_fallback() is handled by
+including <linux/timex.h> rather than <asm/timex.h>.
+
+Finally, there are four functions in vmnet module which are actually used
+in multiple files but instead of proper declarations, their prototype is
+duplicated in vmnet-only/driver.c, risking that the two copies won't match
+(which actually happened in one case). The cleanest solution would be
+creating separate header files for them (bridge.h, netif.h, userif.h and
+vnetUserListener.h) and including them in the respective source file and
+driver.c. As the developers already handle similar cases by simply putting
+the declarations into vnetInt.h, let us do the same to keep things simple.
+---
+ vmmon-only/bootstrap/monLoaderVmmon.c | 1 +
+ vmmon-only/common/vmx86.c | 50 +--------------------------
+ vmmon-only/linux/driver.c | 4 +--
+ vmmon-only/linux/hostif.c | 6 ++--
+ vmnet-only/bridge.c | 2 +-
+ vmnet-only/driver.c | 16 ++-------
+ vmnet-only/vnetInt.h | 7 ++++
+ 7 files changed, 17 insertions(+), 69 deletions(-)
+
+diff --git a/vmnet-only/bridge.c b/vmnet-only/bridge.c
+index b144adab..b46df795 100644
+--- a/vmnet-only/bridge.c
++++ b/vmnet-only/bridge.c
+@@ -1576,7 +1576,7 @@ VNetBridgeComputeHeaderPos(struct sk_buff *skb) // IN: buffer to examine
+ *----------------------------------------------------------------------
+ */
+
+-void
++static void
+ VNetBridgeSendLargePacket(struct sk_buff *skb, // IN: packet to split
+ VNetBridge *bridge) // IN: bridge
+ {
+diff --git a/vmnet-only/driver.c b/vmnet-only/driver.c
+index 602bbfa1..a6f6a7d9 100644
+--- a/vmnet-only/driver.c
++++ b/vmnet-only/driver.c
+@@ -50,18 +50,6 @@
+
+ #include "vmnetInt.h"
+
+-/*
+- * Initialization and creation routines from other files.
+- * Putting them here reduces the need for so many header files.
+- */
+-
+-extern int VNetUserIf_Create(VNetPort **ret);
+-extern int VNetNetIf_Create(char *devName, VNetPort **ret, int hubNum);
+-extern int VNetBridge_Create(char *devName, uint32 flags, VNetJack *hubJack,
+- VNetPort **ret);
+-extern int VNetUserListener_Create(uint32 classMask, VNetJack *hubJack, VNetPort **ret);
+-
+-
+ /*
+ * Structure for cycle detection of host interfaces. This
+ * struct is only used by VNetCycleDetectIf().
+@@ -295,7 +283,7 @@ VNetRemovePortFromList(const VNetPort *port) // IN: port to remove from list
+ *----------------------------------------------------------------------
+ */
+
+-int
++static int
+ LinuxDriverInit(void)
+ {
+ int retval;
+@@ -374,7 +362,7 @@ vmnet_init_module(void)
+ *----------------------------------------------------------------------
+ */
+
+-void
++static void
+ LinuxDriverExit(void)
+ {
+ unregister_chrdev(VNET_MAJOR_NUMBER, "vmnet");
+diff --git a/vmnet-only/vnetInt.h b/vmnet-only/vnetInt.h
+index 5f41269d..cb25e3b8 100644
+--- a/vmnet-only/vnetInt.h
++++ b/vmnet-only/vnetInt.h
+@@ -225,6 +225,13 @@ extern int VNetProc_Init(void);
+
+ extern void VNetProc_Cleanup(void);
+
++int VNetNetIf_Create(char *devName, VNetPort **ret, int hubNum);
++int VNetUserIf_Create(VNetPort **ret);
++int VNetBridge_Create(const char *devName, uint32 flags, VNetJack *hubJack,
++ VNetPort **ret);
++int VNetUserListener_Create(uint32 classMask, VNetJack *hubJack,
++ VNetPort **port);
++
+
+ /*
+ *----------------------------------------------------------------------
+Patch for Linux 6.9 from https://github.com/mkubecek/vmware-host-modules/issues/239
+--- a/vmnet-only/vmnetInt.h
++++ b/vmnet-only/vmnetInt.h
+@@ -62,8 +62,13 @@
+ compat_skb_set_network_header(skb, sizeof (struct ethhdr)), \
+ dev_queue_xmit(skb) \
+ )
+-#define dev_lock_list() read_lock(&dev_base_lock)
+-#define dev_unlock_list() read_unlock(&dev_base_lock)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 9, 0)
++# define dev_lock_list() rcu_read_lock()
++# define dev_unlock_list() rcu_read_unlock()
++#else
++# define dev_lock_list() read_lock(&dev_base_lock)
++# define dev_unlock_list() read_unlock(&dev_base_lock)
++#endif
+ #ifdef VMW_NETDEV_HAS_NET
+ # define DEV_GET(x) __dev_get_by_name(&init_net, (x)->name)
+ # ifdef VMW_NETDEV_HAS_DEV_NET