--- vmnet-only.orig/driver.c 2005-12-23 18:10:37.000000000 -0500 +++ vmnet-only/driver.c 2006-01-23 19:21:54.000000000 -0500 @@ -1393,7 +1393,11 @@ return FALSE; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14) + for (fd = 0; fd < p->files->fdt->max_fds; fd++) { +#else for (fd = 0; fd < p->files->max_fds; fd++) { +#endif #ifdef KERNEL_2_3_99 file = fcheck_files(p->files, fd); #else diff -urbB vmnet-only.orig/userif.c vmnet-only/userif.c --- vmnet-only.orig/userif.c 2005-12-23 18:10:37.000000000 -0500 +++ vmnet-only/userif.c 2006-01-23 19:41:56.000000000 -0500 @@ -75,6 +75,11 @@ static void VNetUserIfUnsetupNotify(VNetUserIF *userIf); static int VNetUserIfSetupNotify(VNetUserIF *userIf, VNet_Notify *vn); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11) +extern int skb_copy_datagram(const struct sk_buff *from, + int offset, char __user *to, int size); +#endif + /* *----------------------------------------------------------------------------- * @@ -153,12 +158,21 @@ static INLINE int VNetUserIfMapUint32Ptr(VA uAddr, struct page **p, uint32 **ptr) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14) + if (access_ok(VERIFY_READ, (void *)uAddr, sizeof (uint32)) || + access_ok(VERIFY_WRITE, (void *)uAddr, sizeof (uint32)) || + (((uAddr + sizeof(uint32)) & ~(PAGE_SIZE - 1)) != + (uAddr & ~(PAGE_SIZE - 1)))) { + return -EINVAL; + } +#else if (verify_area(VERIFY_READ, (void *)uAddr, sizeof (uint32)) || verify_area(VERIFY_WRITE, (void *)uAddr, sizeof (uint32)) || (((uAddr + sizeof(uint32)) & ~(PAGE_SIZE - 1)) != (uAddr & ~(PAGE_SIZE - 1)))) { return -EINVAL; } +#endif *p = UserifLockPage(uAddr); if (*p == NULL) { @@ -932,3 +946,19 @@ *ret = (VNetPort*)userIf; return 0; } + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11) +/* + * Copy a datagram to a linear buffer. See + * http://lkml.org/lkml/2005/1/22/60 for source reference. + */ +int skb_copy_datagram(const struct sk_buff *skb, int offset, char __user *to, int size) +{ + struct iovec iov = { + .iov_base = to, + .iov_len =size, + }; + + return skb_copy_datagram_iovec(skb, offset, &iov, size); +} +#endif