Package-Name: vmware
Compile-Requires: vmware-any-any
# popt is required for vmware-[ns]mbd
Requires: XFree86|Xorg popt modutils|module-init-tools pciutils
# commented out because it can't be done automatically
#Rebuild-For: linux
#Source: ftp://vmware.wespe.de/pub/software/VMware-workstation-(\d+.\d+.\d+)-\d+.tar.gz $1
# Alternate sources (no longer?):
#	http://vmware-svca.www.conxion.com/software/*.tar.gz (CA,USA)
#	http://vmware-chil.www.conxion.com/software/*.tar.gz (IL,USA)
#	http://vmware-heva.www.conxion.com/software/*.tar.gz (VA,USA)
Source: http://www.vmware.com/download/ws//(Version:(?:\s|&nbsp;)*(\d+(\.\d+)+)(?:\s|&nbsp;)*\|[^|]*\|(?:\s|&nbsp;)*Build:(?:\s|&nbsp;)*(\d+))/[\0-\377]*Version:(?:\s|&nbsp;)*(\d+(.\d+)+)(?:\s|&nbsp;)*\|[^|]*\|(?:\s|&nbsp;)*Build:(?:\s|&nbsp;)*(\d+) $1 http://download2.vmware.com/software/wkst/VMware-workstation-$1-$3.i386.tar.gz
Interactive-Compile: 1
Explicit-Only: 1
Repack:
	tar xzvfp "$(SOURCE)"
	mv vmware-distrib vmware-"$(VERSION)"
Compile:
	mkdir -p /etc/vmware
	chmod 700 /etc/vmware
	mkdir -p "$(PREFIX)"/etc/rc.d/{init,rc{0,1,2,3,4,5,6}}.d
	trap "test ! -f etc/locations.old || mv -f etc/locations.old /etc/locations" ERR ; \
		set -e ; \
		if test -f /etc/vmware/locations ; then \
			cp -pf /etc/vmware/locations etc/locations.old ; \
			sed <etc/locations.old >/etc/vmware/locations \
				-e 's#^\(answer BUILDR_vmblock\) .*#\1 yes#' \
				-e 's#^\(answer BUILDR_vmmon\) .*#\1 yes#' \
				-e 's#^\(answer BUILDR_vmnet\) .*#\1 yes#' \
				-e 's#^\(answer HEADER_DIR\) .*#\1 /lib/modules/$(shell uname -r)/build/include#' ; \
		else \
# Note that it might be a dangling symlink, so we rm it just in case
			rm -rf /etc/vmware/locations ; \
			echo >>/etc/vmware/locations 'file /etc/vmware/locations' ; \
			echo >>/etc/vmware/locations 'answer BINDIR $(PREFIX)/bin' ; \
			echo >>/etc/vmware/locations 'answer LIBDIR $(PREFIX)/lib/vmware' ; \
			echo >>/etc/vmware/locations 'answer MANDIR $(PREFIX)/man' ; \
			echo >>/etc/vmware/locations 'answer DOCDIR $(PREFIX)/doc/vmware' ; \
			echo >>/etc/vmware/locations 'answer INITDIR $(PREFIX)/etc/rc.d' ; \
			echo >>/etc/vmware/locations 'answer INITSCRIPTSDIR $(PREFIX)/etc/rc.d/init.d' ; \
			echo >>/etc/vmware/locations 'answer BUILDR_vmmon yes' ; \
			echo >>/etc/vmware/locations 'answer BUILDR_vmnet yes' ; \
			echo >>/etc/vmware/locations 'answer HEADER_DIR /lib/modules/$(shell uname -r)/build/include' ; \
#			echo >>/etc/vmware/locations 'file /etc/vmware/installer.sh '`date +%s` ; \
#			echo >>/etc/vmware/locations 'file /pkg/vmware/bin/vmware-uninstall.pl '`date +%s` ; \
			rm -f /etc/vmware/installer.sh ; \
			cp -p etc/installer.sh /etc/vmware/ ; \
			mkdir -p "$(PREFIX)"/bin ; \
			chmod 755 "$(PREFIX)"/bin ; \
			rm -f "$(PREFIX)"/bin/vmware-uninstall.pl ; \
			echo  >"$(PREFIX)"/bin/vmware-uninstall.pl '#!/bin/sh' ; \
			echo >>"$(PREFIX)"/bin/vmware-uninstall.pl 'rm -f /etc/vmware/installer.sh "$(PREFIX)"/bin/vmware-uninstall.pl' ; \
			echo >>"$(PREFIX)"/bin/vmware-uninstall.pl 'rmdir "$(PREFIX)"/bin' ; \
			chmod 755 "$(PREFIX)"/bin/vmware-uninstall.pl ; \
		fi ; \
		./vmware-install.pl
#		if test -f etc/locations.old ; then \
#			mv -f /etc/locations /etc/locations~ ; \
#			while read type what rest ; do \
#				if test "x$type" = xanswer ; then \
#					grep -i "^$type $what " etc/locations.
#				else \
#					echo "$type $what $rest" ; \
#				fi ; \
#			done < /etc/locations~ > /etc/locations ; \
#			echo rm -f /etc/locations~ ; \
#		fi
#	cd "$(PREFIX)"/../vmware-any-any && perl runme.pl
	sed -e 's/insmod -s -f/insmod -s/' -e 's/sleep 1/sleep 0.1/' <"$(PREFIX)"/etc/rc.d/init.d/vmware >"$(PREFIX)"/etc/rc.d/init.d/vmware~
	mv -f "$(PREFIX)"/etc/rc.d/init.d/vmware~ "$(PREFIX)"/etc/rc.d/init.d/vmware
	if test -f "$(PREFIX)"/man/man1/vmware.1.gz -a ! -f "$(PREFIX)"/man/man1/vmware.1 ; then gzip -df "$(PREFIX)"/man/man1/vmware.1.gz ; fi
Install:
	$(MAKE) instbin BIN="vmware vmware-config.pl"
	$(MAKE) instman SECTION=1 MAN=vmware
	ln -fs "$(PREFIX)"/etc/rc.d/init.d/vmware /etc/rc.d/init.d/
	ln -fs ../init.d/vmware /etc/rc.d/rc1.d/K90vmware
	ln -fs ../init.d/vmware /etc/rc.d/rc3.d/S90vmware
	chmod 700 /etc/rc.d/init.d/vmware
	# Death to hard-coded paths!!
	rm -rf /usr/lib/vmware
	ln -s "$(PREFIX)"/lib/vmware /usr/lib/
No-Patch: <<EOT
--- bin/vmware-config.pl.old	2006-04-24 21:28:33 +0900
+++ bin/vmware-config.pl	2006-04-24 21:31:56 +0900
@@ -1853,7 +1853,7 @@
     . ' -E - | ' . shell_string($gHelper{'grep'}) . ' '
     . shell_string($pattern));
   chomp($header_page_offset);
-  $header_page_offset =~ s/^$pattern \(?0x([0-9a-fA-F]{8,}).*$/$1/;
+  $header_page_offset =~ s/^$pattern .*?0x([0-9a-fA-F]{8,}).*$/$1/;
   if ($header_page_offset =~ /[0-9a-fA-F]{8,}/) {
     # We found a valid page offset
     if (defined($gSystem{'page_offset'}) and
@@ -2712,6 +2712,7 @@
                                                             : '')
              . shell_string('HEADER_DIR=' . db_get_answer('HEADER_DIR')) . ' '
              . shell_string('CC=' . $gHelper{'gcc'}) . ' '
+	     . 'NOSTDINC_FLAGS="-nostdinc -iprefix `gcc -print-search-dirs | grep \'^install:\' | sed \'s/^install: *//\'` -iwithprefix include" kbuild_2_4_nostdinc=\'$(NOSTDINC_FLAGS)\'' . ' '
              . shell_string('GREP=' . $gHelper{'grep'}) . ' '
              . shell_string('IS_GCC_3='
              . (($gSystem{'gcc_version'} =~ /^3\./) ? 'yes' : 'no')))) {
--- bin/vmware-uninstall.pl.old	2004-06-11 10:32:52 +0900
+++ bin/vmware-uninstall.pl	2004-06-21 21:12:17 +0900
@@ -1995,6 +1995,8 @@
       }
     }
   }
+# The "packager" way
+$initdir = '/pkg/vmware/etc/rc.d';
   $answer = get_persistent_answer('What is the directory that contains the init'
                                   .' directories (rc0.d/ to rc6.d/)?'
                                   , 'INITDIR', 'initdirpath', $initdir);
@@ -2008,6 +2010,8 @@
       $initscriptsdir = '';
     }
   }
+# The "packager" way
+$initscriptsdir = '/pkg/vmware/etc/rc.d/init.d';
   $answer = get_persistent_answer('What is the directory that contains the init'
                                   .' scripts?', 'INITSCRIPTSDIR'
                                   , 'initscriptsdirpath', $initscriptsdir);
--- installer/services.sh.old	2004-06-11 10:32:54 +0900
+++ installer/services.sh	2004-06-25 16:21:39 +0900
@@ -667,7 +667,7 @@
   # Disable logging to avoid the uncontrolled creation of unmanaged files
   cd "$vmdb_answer_BINDIR" && "$vmdb_answer_BINDIR"/"$smbd" -D -l /dev/null \
     -s "$vmware_etc_dir"/"$vHostIf"/smb/smb.conf \
-    -f /var/run/"$smbd"-"$vHostIf".pid
+    -f /var/run/"$smbd"-"$vHostIf".pid -p 445
 }
 
 # Stop a SMB share server on a private IP network
@@ -876,11 +876,11 @@
 	fi
 
         if [ "$exitcode" -gt 0 ]; then
-          # Set the 'not configured' flag
-          touch "$vmware_etc_dir"'/not_configured'
-          chmod 644 "$vmware_etc_dir"'/not_configured'
-          db_add_file "$vmware_db" "$vmware_etc_dir"'/not_configured' \
-            "$vmware_etc_dir"'/not_configured'
+#          # Set the 'not configured' flag
+#          touch "$vmware_etc_dir"'/not_configured'
+#          chmod 644 "$vmware_etc_dir"'/not_configured'
+#          db_add_file "$vmware_db" "$vmware_etc_dir"'/not_configured' \
+#            "$vmware_etc_dir"'/not_configured'
           exit 1
         fi
 
EOT
vmmon-2623-Patch: <<EOT
######## begin patch to fix 6.0.0 vmmon for 2.6.23 kernel
--- linux/driver.c.old	2007-05-02 13:08:21 +0900
+++ linux/driver.c	2007-11-20 17:23:19 +0900
@@ -1711,7 +1711,9 @@
 	  current->fsuid == current->uid &&
           current->egid == current->gid &&
 	  current->fsgid == current->gid) {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 7)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23)
+         set_dumpable(current->mm, 1 << MMF_DUMPABLE);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 7)
 	 current->mm->dumpable = 1;
 #else
 	 current->dumpable = 1;
######## end patch to fix 6.0.0 vmmon for 2.6.23 kernel
EOT
vmnet-2623-Patch: <<EOT
######## begin patch to fix 6.0.0 vmnet for 2.6.23 kernel
--- driver.c.old	2007-05-02 13:08:22 +0900
+++ driver.c	2007-11-22 00:31:49 +0900
@@ -525,14 +525,8 @@
 void
 cleanup_module(void)
 {
-   int retval;
-
    unregister_ioctl32_handlers();
-   retval =  unregister_chrdev(VNET_MAJOR_NUMBER, "vmnet");
-   if (retval != 0 ) {
-      LOG(0, (KERN_WARNING "/dev/vmnet: could not unregister major device %d\n", 
-	      VNET_MAJOR_NUMBER));
-   }
+   unregister_chrdev(VNET_MAJOR_NUMBER, "vmnet");
    VNetProtoUnregister();
    VNetProc_Cleanup();
 #ifdef CONFIG_NETFILTER
--- /no/such/file	1994-07-18 08:46:18 +0900
+++ compat_skbuff.h	2007-10-08 23:29:31 +0900
@@ -0,0 +1,63 @@
+/* **********************************************************
+ * Copyright (C) 2007 VMware, Inc.  All Rights Reserved. -- VMware Confidential
+ * **********************************************************/
+
+#ifndef __COMPAT_SKBUFF_H__
+#   define __COMPAT_SKBUFF_H__
+
+#include <linux/skbuff.h>
+
+/*
+ * When transition from mac/nh/h to skb_* accessors was made, also SKB_WITH_OVERHEAD
+ * was introduced.
+ */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 22) || \
+   (LINUX_VERSION_CODE == KERNEL_VERSION(2, 6, 21) && defined(SKB_WITH_OVERHEAD))
+#define compat_skb_mac_header(skb)         skb_mac_header(skb)
+#define compat_skb_network_header(skb)     skb_network_header(skb)
+#define compat_skb_network_offset(skb)     skb_network_offset(skb)
+#define compat_skb_transport_header(skb)   skb_transport_header(skb)
+#define compat_skb_transport_offset(skb)   skb_transport_offset(skb)
+#define compat_skb_network_header_len(skb) skb_network_header_len(skb)
+#define compat_skb_tail_pointer(skb)       skb_tail_pointer(skb)
+#define compat_skb_end_pointer(skb)        skb_end_pointer(skb)
+#define compat_skb_ip_header(skb)          ((struct iphdr *)skb_network_header(skb))
+#define compat_skb_tcp_header(skb)         ((struct tcphdr *)skb_transport_header(skb))
+#define compat_skb_reset_mac_header(skb)   skb_reset_mac_header(skb)
+#define compat_skb_set_network_header(skb, off)   skb_set_network_header(skb, off)
+#define compat_skb_set_transport_header(skb, off) skb_set_transport_header(skb, off)
+#else
+#define compat_skb_mac_header(skb)         (skb)->mac.raw
+#define compat_skb_network_header(skb)     (skb)->nh.raw
+#define compat_skb_network_offset(skb)     ((skb)->nh.raw - (skb)->data)
+#define compat_skb_transport_header(skb)   (skb)->h.raw
+#define compat_skb_transport_offset(skb)   ((skb)->h.raw - (skb)->data)
+#define compat_skb_network_header_len(skb) ((skb)->h.raw - (skb)->nh.raw)
+#define compat_skb_tail_pointer(skb)       (skb)->tail
+#define compat_skb_end_pointer(skb)        (skb)->end
+#define compat_skb_ip_header(skb)          (skb)->nh.iph
+#define compat_skb_tcp_header(skb)         (skb)->h.th
+#define compat_skb_reset_mac_header(skb)   ((skb)->mac.raw = (skb)->data)
+#define compat_skb_set_network_header(skb, off)   ((skb)->nh.raw = (skb)->data + (off))
+#define compat_skb_set_transport_header(skb, off) ((skb)->h.raw = (skb)->data + (off))
+#endif
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20)
+#define compat_skb_csum_offset(skb)        (skb)->csum_offset
+#else
+#define compat_skb_csum_offset(skb)        (skb)->csum
+#endif
+
+/*
+ * Note that compat_skb_csum_start() has semantic different from kernel's csum_start:
+ * kernel's skb->csum_start is offset between start of checksummed area and start of
+ * complete skb buffer, while our compat_skb_csum_start(skb) is offset from start
+ * of packet itself.
+ */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 22)
+#define compat_skb_csum_start(skb)         ((skb)->csum_start - skb_headroom(skb))
+#else
+#define compat_skb_csum_start(skb)         compat_skb_transport_offset(skb)
+#endif
+
+#endif /* __COMPAT_SKBUFF_H__ */
--- userif.c.old	2007-05-02 13:08:22 +0900
+++ userif.c	2007-10-08 23:29:31 +0900
@@ -18,7 +18,7 @@
 
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
-#include <linux/skbuff.h>
+#include "compat_skbuff.h"
 #include <linux/if_ether.h>
 #include <linux/sockios.h>
 #include "compat_sock.h"
@@ -622,18 +622,18 @@
 #else
    /*
     * If truncation occurs, we do not bother with checksumming - caller cannot
-    * verify checksum anyway in such case, and copy without checksum it is
+    * verify checksum anyway in such case, and copy without checksum is
     * faster.
     */
    if (skb->pkt_type == PACKET_OUTGOING && 	/* Packet must be outgoing */
        skb->ip_summed == VM_CHECKSUM_PARTIAL &&	/* Without checksum */
-       skb->h.raw != skb->nh.raw &&		/* We must know where header is */
+       compat_skb_network_header_len(skb) &&    /* We must know where header is */
        skb->len == count) {			/* No truncation may occur */
       size_t skl;
       int csum;
       u_int16_t csum16;
-      
-      skl = skb->h.raw - skb->data;
+     
+      skl = compat_skb_csum_start(skb);
       if (VNetCopyDatagram(skb, buf, skl)) {
 	 return -EFAULT;
       }
@@ -642,7 +642,8 @@
 	 return csum;
       }
       csum16 = csum;
-      if (copy_to_user(buf + skl + skb->csum, &csum16, sizeof csum16)) {
+      if (copy_to_user(buf + skl + compat_skb_csum_offset(skb),
+                       &csum16, sizeof csum16)) {
 	 return -EFAULT;
       }
    } else {
--- vnetInt.h.old	2007-05-02 13:08:22 +0900
+++ vnetInt.h	2007-11-22 00:38:38 +0900
@@ -25,8 +25,8 @@
 #define DEV_QUEUE_XMIT(skb, dev, pri)	(                 \
     (skb)->dev = (dev),                                   \
     (skb)->priority = (pri),                              \
-    (skb)->mac.raw = (skb)->data,                         \
-    (skb)->nh.raw = (skb)->data + sizeof (struct ethhdr), \
+    compat_skb_reset_mac_header(skb),                     \
+    compat_skb_set_network_header(skb, sizeof (struct ethhdr)),  \
     dev_queue_xmit(skb)                                   \
   )
 #ifdef KERNEL_2_3_15
--- bridge.c.old	2007-05-02 13:08:22 +0900
+++ bridge.c	2007-11-22 00:37:12 +0900
@@ -19,7 +19,7 @@
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/mm.h>
-#include <linux/skbuff.h>
+#include "compat_skbuff.h"
 #include <linux/sockios.h>
 #include "compat_sock.h"
 
@@ -60,7 +60,7 @@
 typedef struct VNetBridge VNetBridge;
 
 struct VNetBridge {
-   struct notifier_block    notifier;       // for device state changes 
+   struct notifier_block    notifier;       // for device state changes
    char                     name[VNET_NAME_LEN]; // name of net device (e.g., "eth0")
    struct net_device       *dev;            // device structure for 'name'
    struct sock             *sk;             // socket associated with skb's
@@ -81,7 +81,8 @@
 
 static int  VNetBridgeNotify(struct notifier_block *this, u_long msg,
 			     void *data);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 14)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 14) && \
+    !defined(VMW_TL10S64_WORKAROUND)
 static int VNetBridgeReceiveFromDev(struct sk_buff *skb,
                                     struct net_device *dev,
                                     struct packet_type *pt);
@@ -111,7 +112,7 @@
  *
  *      XXX need locking?
  *
- * Results: 
+ * Results:
  *      None.
  *
  * Side effects:
@@ -125,7 +126,7 @@
 {
    struct net_device *dev = bridge->dev;
 
-   /* 
+   /*
     * Disable wireless cards from going into promiscous mode because those
     * cards which do support RF monitoring would not be able to function
     * correctly i.e. they would not be able to send data packets.
@@ -149,7 +150,7 @@
  *
  *      XXX need locking?
  *
- * Results: 
+ * Results:
  *      None.
  *
  * Side effects:
@@ -165,7 +166,7 @@
 
    if (bridge->enabledPromisc && !bridge->wirelessAdapter) {
       dev_set_promiscuity(dev, -1);
-      bridge->enabledPromisc = FALSE;   
+      bridge->enabledPromisc = FALSE;
       LOG(0, (KERN_NOTICE "bridge-%s: disabled promiscuous mode\n",
 	      bridge->name));
    }
@@ -183,7 +184,7 @@
  *
  *      XXX need locking?
  *
- * Results: 
+ * Results:
  *      None.
  *
  * Side effects:
@@ -220,8 +221,8 @@
  *      Create a bridge.  Allocates/initializes struct, registers
  *      with kernel for device state changes, connects to virtual
  *      hub, initializes port/jack, and creates a proc entry.
- * 
- * Results: 
+ *
+ * Results:
  *      Errno. Also returns an allocated jack to connect to,
  *      NULL on error.
  *
@@ -240,7 +241,7 @@
    int retval = 0;
 
    *ret = NULL;
-   
+
    /*
     * Its an error if device name is empty.
     */
@@ -296,7 +297,7 @@
 
    bridge->port.jack.peer = NULL;
    bridge->port.jack.numPorts = 1;
-   VNetSnprintf(bridge->port.jack.name, sizeof bridge->port.jack.name, 
+   VNetSnprintf(bridge->port.jack.name, sizeof bridge->port.jack.name,
 		"bridge%u", bridge->port.id);
    bridge->port.jack.private = bridge;
    bridge->port.jack.index = 0;
@@ -306,11 +307,11 @@
    bridge->port.jack.cycleDetect = VNetBridgeCycleDetect;
    bridge->port.jack.portsChanged = VNetBridgePortsChanged;
    bridge->port.jack.isBridged = VNetBridgeIsBridged;
-   
+
    /*
     * Make proc entry for this jack.
     */
-   
+
    retval = VNetProc_MakeEntry(NULL, bridge->port.jack.name, S_IFREG,
                                &bridge->port.jack.procEntry);
    if (retval) {
@@ -327,7 +328,7 @@
    /*
     * Rest of fields.
     */
-   
+
    bridge->port.flags = IFF_RUNNING;
 
    memset(bridge->port.paddr, 0, sizeof bridge->port.paddr);
@@ -343,10 +344,10 @@
    bridge->port.fileOpPoll = NULL;
 
    *ret = &bridge->port;
-   
+
    LOG(1, (KERN_DEBUG "bridge-%s: attached\n", bridge->name));
    return 0;
-   
+
 out:
    if (bridge != NULL) {
       if (bridge->notifier.notifier_call != NULL) {
@@ -365,8 +366,8 @@
  *
  *      Disconnect the bridge, unregister from device state
  *      notifications, remove proc entry, and deallocate struct.
- * 
- * Results: 
+ *
+ * Results:
  *      None.
  *
  * Side effects:
@@ -379,7 +380,7 @@
 VNetBridgeFree(VNetJack *this) // IN: jack to free
 {
    VNetBridge *bridge = (VNetBridge*)this->private;
-   
+
    if (bridge->dev != NULL) {
       VNetBridgeDown(bridge);
    }
@@ -406,11 +407,11 @@
  *
  *      Wrapper for SMAC functions.
  *
- * Results: 
+ * Results:
  *      Packet Status.
  *
  * Side effects:
- *      The skb buffer is freed if not succesfull otherwise it points to 
+ *      The skb buffer is freed if not succesfull otherwise it points to
  *      the clone.
  *
  *----------------------------------------------------------------------
@@ -456,8 +457,8 @@
  *      When the function sends up it keeps a reference to the
  *      packet in a history list so that we can avoid handing
  *      a VM a copy of its own packet.
- * 
- * Results: 
+ *
+ * Results:
  *      None.
  *
  * Side effects:
@@ -484,13 +485,13 @@
       return;
    }
 
-   /* 
+   /*
     * skb might be freed by wireless code, so need to keep
     * a local copy of the MAC rather than a pointer to it.
     */
 
    memcpy(dest, SKB_2_DESTMAC(skb), ETH_ALEN);
-   
+
    /*
     * Check promiscuous bit periodically
     */
@@ -519,7 +520,7 @@
 
    if (bridge->smac) {
       if (VNetCallSMACFunc(bridge->smac, &skb, skb->data,
-                           SMAC_CheckPacketToHost) != 
+                           SMAC_CheckPacketToHost) !=
           PacketStatusForwardPacket) {
          LOG(4, (KERN_NOTICE "bridge-%s: packet dropped .\n",
                  bridge->name));
@@ -587,9 +588,9 @@
       if (clone) {
 	 unsigned long flags;
 	 int i;
-	 
+
 	 atomic_inc(&clone->users);
-	 
+
 	 clone->dev = dev;
 	 clone->protocol = eth_type_trans(clone, dev);
 	 spin_lock_irqsave(&bridge->historyLock, flags);
@@ -622,7 +623,7 @@
 	       /*
 		* We special case 0 to avoid races with another thread on
 		* another cpu wanting to use the 0 entry. This could happen
-		* when we release the lock to free the former entry. 
+		* when we release the lock to free the former entry.
 		* See bug 11231 for details.
 		*/
 	       if (i == 0) {
@@ -664,8 +665,8 @@
  * VNetBridgeCycleDetect --
  *
  *      Cycle detection algorithm.
- * 
- * Results: 
+ *
+ * Results:
  *      TRUE if a cycle was detected, FALSE otherwise.
  *
  * Side effects:
@@ -678,7 +679,7 @@
 VNetBridgeCycleDetect(VNetJack *this,       // IN: jack
                       int       generation) // IN: generation
 {
-   VNetBridge *bridge = (VNetBridge*)this->private; 
+   VNetBridge *bridge = (VNetBridge*)this->private;
    return VNetCycleDetectIf(bridge->name, generation);
 }
 
@@ -691,8 +692,8 @@
  *      The number of ports connected to this jack has change, react
  *      accordingly by starting/stopping promiscuous mode based on
  *      whether any peers exist.
- * 
- * Results: 
+ *
+ * Results:
  *      None.
  *
  * Side effects:
@@ -721,8 +722,8 @@
  * VNetBridgeIsBridged --
  *
  *      Reports if the bridged interface is up or down.
- * 
- * Results: 
+ *
+ * Results:
  *      1 - we are bridged but the interface is not up
  *      2 - we are bridged and the interface is up
  *
@@ -750,8 +751,8 @@
  *
  *      Check if the device is a wireless adapter, depending on the version
  *      of the wireless extension present in the kernel.
- * 
- * Results: 
+ *
+ * Results:
  *      TRUE if the device is wireless, FALSE otherwise.
  *
  * Side effects:
@@ -760,7 +761,7 @@
  *----------------------------------------------------------------------
  */
 
-static Bool 
+static Bool
 VNetBridgeIsDeviceWireless(struct net_device *dev) //IN: sock
 {
 #if !defined(CONFIG_NET_RADIO)
@@ -780,12 +781,12 @@
  * VNetBridgeUp --
  *
  *      Bring a bridge up.  Gets peer's device structure, verifies
- *      that interface is up, checks the header length, 
+ *      that interface is up, checks the header length,
  *      allocates a socket, adds a packet handler to the network
- *      stack, and then places the peer's device in promiscuous 
+ *      stack, and then places the peer's device in promiscuous
  *      mode.
  *
- * Results: 
+ * Results:
  *      errno.
  *
  * Side effects:
@@ -833,7 +834,7 @@
     */
 
    if (bridge->dev->hard_header_len != ETH_HLEN) {
-      LOG(1, (KERN_DEBUG "bridge-%s: can't bridge with %s, bad header length %d\n", 
+      LOG(1, (KERN_DEBUG "bridge-%s: can't bridge with %s, bad header length %d\n",
 	      bridge->name, bridge->dev->name, bridge->dev->hard_header_len));
       dev_unlock_list();
       retval = -EINVAL;
@@ -867,7 +868,7 @@
       SMAC_InitState(&(bridge->smac));
       if (bridge->smac) {
          /*
-          * Store the MAC address of the adapter 
+          * Store the MAC address of the adapter
           */
 
          SMAC_SetMac(bridge->smac, bridge->dev->dev_addr);
@@ -875,7 +876,7 @@
    }
 
    /*
-    * Link up with the peer device by adding a 
+    * Link up with the peer device by adding a
     * packet handler to the networking stack.
     */
 
@@ -897,7 +898,7 @@
    bridge->warnPromisc = FALSE;
    dev_add_pack(&bridge->pt);
    dev_unlock_list();
-   
+
    /*
     * Put in promiscuous mode if need be.
     */
@@ -907,7 +908,7 @@
       VNetBridgeStartPromisc(bridge);
    }
    up(&vnetStructureSemaphore);
-   
+
    /*
     * Finish up
     */
@@ -939,7 +940,7 @@
  *      packet handler from the network stack, and frees the
  *      socket.
  *
- * Results: 
+ * Results:
  *      None.
  *
  * Side effects:
@@ -976,7 +977,7 @@
  *      Callback on peer device state change.  The function brings
  *      the bridge up/down in response to changes in the peer device.
  *
- * Results: 
+ * Results:
  *      NOTIFY_DONE
  *
  * Side effects:
@@ -1070,11 +1071,11 @@
  *
  *      Compute correct position for UDP/TCP header.
  *
- * Results: 
+ * Results:
  *      None.
  *
  * Side effects:
- *      skb->h.raw updated to point to the tcp/udp header.
+ *      transport header pointer updated to point to the tcp/udp header.
  *
  *----------------------------------------------------------------------
  */
@@ -1083,16 +1084,20 @@
 VNetBridgeComputeHeaderPos(struct sk_buff *skb) // IN: buffer to examine
 {
    /* Maybe some kernel gets it right... */
-   if (skb->h.raw != skb->nh.raw) {
+   if (compat_skb_network_header_len(skb)) {
       return;
    }
    switch (be16_to_cpu(skb->protocol)) {
-      case ETH_P_IP:
-         skb->h.raw = skb->nh.raw + (skb->nh.raw[0] & 0x0F) * 4;
+      case ETH_P_IP: {
+            struct iphdr *ipHdr = compat_skb_ip_header(skb);
+
+            compat_skb_set_transport_header(skb, compat_skb_network_offset(skb) +
+                                                 ipHdr->ihl * 4);
+         }
 	 return;
       default:
-         LOG(3, (KERN_DEBUG "Unknown EII protocol %04X: csum at %d\n", 
-		 be16_to_cpu(skb->protocol), skb->csum));
+         LOG(3, (KERN_DEBUG "Unknown EII protocol %04X: csum at %d\n",
+		 be16_to_cpu(skb->protocol), compat_skb_csum_offset(skb)));
 	 break;
    }
    return;
@@ -1101,7 +1106,7 @@
 
 /*
  * We deal with three types of kernels:
- * New kernels: skb_shinfo() has gso_size member, and there is 
+ * New kernels: skb_shinfo() has gso_size member, and there is
  *              skb_gso_segment() helper to split GSO skb into flat ones.
  * Older kernels: skb_shinfo() has tso_size member, and there is
  *                no helper.
@@ -1143,21 +1148,21 @@
    uint16 ipID;
    uint32 seqNo;
 
-   if (((struct ethhdr *)skb->mac.raw)->h_proto != htons(ETH_P_IP)) {
+   if (((struct ethhdr *)compat_skb_mac_header(skb))->h_proto != htons(ETH_P_IP)) {
       return ERR_PTR(-EPFNOSUPPORT);
    }
 
-   if (skb->nh.iph->protocol != IPPROTO_TCP) {
+   if (compat_skb_ip_header(skb)->protocol != IPPROTO_TCP) {
       return ERR_PTR(-EPROTONOSUPPORT);
    }
 
-   macHdrLen = skb->nh.raw - skb->mac.raw;
-   ipHdrLen = skb->nh.iph->ihl << 2;
-   tcpHdrLen = skb->h.th->doff << 2;
+   macHdrLen = compat_skb_network_header(skb) - compat_skb_mac_header(skb);
+   ipHdrLen = compat_skb_ip_header(skb)->ihl << 2;
+   tcpHdrLen = compat_skb_tcp_header(skb)->doff << 2;
    allHdrLen = macHdrLen + ipHdrLen + tcpHdrLen;
 
-   ipID = ntohs(skb->nh.iph->id);
-   seqNo = ntohl(skb->h.th->seq);
+   ipID = ntohs(compat_skb_ip_header(skb)->id);
+   seqNo = ntohl(compat_skb_tcp_header(skb)->seq);
 
    /* Host TCP stack populated this (MSS) for the host NIC driver */
    bytesPerPacket = skb_shinfo(skb)->tso_size;
@@ -1194,36 +1199,37 @@
       memcpy(skb_put(newSkb, allHdrLen), skb->data, allHdrLen);
 
       /* Fix up pointers to different layers */
-      newSkb->mac.raw = newSkb->data;
-      newSkb->nh.raw = newSkb->data + macHdrLen;
-      newSkb->h.raw = newSkb->nh.raw + ipHdrLen;
+      compat_skb_reset_mac_header(newSkb);
+      compat_skb_set_network_header(newSkb, macHdrLen);
+      compat_skb_set_transport_header(newSkb, macHdrLen + ipHdrLen);
 
       /* Payload copy */
-      skb_copy_bits(skb, curByteOffset, newSkb->tail, payloadSize);
+      skb_copy_bits(skb, curByteOffset, compat_skb_tail_pointer(newSkb), payloadSize);
       skb_put(newSkb, payloadSize);
 
       curByteOffset+=payloadSize;
       bytesLeft -= payloadSize;
 
       /* Fix up IP hdr */
-      newSkb->nh.iph->tot_len = htons(payloadSize + tcpHdrLen + ipHdrLen);
-      newSkb->nh.iph->id = htons(ipID);
-      newSkb->nh.iph->check = 0;
+      compat_skb_ip_header(newSkb)->tot_len = htons(payloadSize + tcpHdrLen + ipHdrLen);
+      compat_skb_ip_header(newSkb)->id = htons(ipID);
+      compat_skb_ip_header(newSkb)->check = 0;
       /* Recompute new IP checksum */
-      newSkb->nh.iph->check =
-         ip_fast_csum((uint8 *)newSkb->nh.iph, newSkb->nh.iph->ihl);
+      compat_skb_ip_header(newSkb)->check =
+              ip_fast_csum(compat_skb_network_header(newSkb),
+                           compat_skb_ip_header(newSkb)->ihl);
 
       /* Fix up TCP hdr */
-      newSkb->h.th->seq = htonl(seqNo);
+      compat_skb_tcp_header(newSkb)->seq = htonl(seqNo);
       /* Clear FIN/PSH if not last packet */
       if (bytesLeft > 0) {
-         newSkb->h.th->fin = 0;
-         newSkb->h.th->psh = 0;
+         compat_skb_tcp_header(newSkb)->fin = 0;
+         compat_skb_tcp_header(newSkb)->psh = 0;
       }
       /* Recompute partial TCP checksum */
-      newSkb->h.th->check =
-         ~csum_tcpudp_magic(newSkb->nh.iph->saddr,
-                            newSkb->nh.iph->daddr,
+      compat_skb_tcp_header(newSkb)->check =
+         ~csum_tcpudp_magic(compat_skb_ip_header(newSkb)->saddr,
+                            compat_skb_ip_header(newSkb)->daddr,
                             payloadSize+tcpHdrLen, IPPROTO_TCP, 0);
 
       /* Offset of field */
@@ -1252,8 +1258,8 @@
  * VNetBridgeSendLargePacket --
  *
  *      Split and send a large TCP/IPv4 sk_buff into multiple sk_buffs which
- *      fits on wire.  Called from VNetBridgeReceiveFromDev(), which is a 
- *	protocol handler called from the bottom half, so steady as she 
+ *      fits on wire.  Called from VNetBridgeReceiveFromDev(), which is a
+ *	protocol handler called from the bottom half, so steady as she
  *	goes...
  *
  *	skb passed in is deallocated by function.
@@ -1304,7 +1310,7 @@
  *
  *      This is called from the bottom half.  Must be careful.
  *
- * Results: 
+ * Results:
  *      errno.
  *
  * Side effects:
@@ -1313,7 +1319,8 @@
  *----------------------------------------------------------------------
  */
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 14)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 14) && \
+    !defined(VMW_TL10S64_WORKAROUND)
 int
 VNetBridgeReceiveFromDev(struct sk_buff *skb,         // IN: packet to receive
                          struct net_device *dev,      // IN: unused
@@ -1337,7 +1344,7 @@
       return -EIO;	// value is ignored anyway
    }
 
-   /* 
+   /*
     * Check is this is a packet that we sent up to the host, and if
     * so then don't bother to receive the packet.
     */
@@ -1364,14 +1371,14 @@
       do_gettimeofday(&now);
       LOG(3, (KERN_DEBUG "bridge-%s: time %d\n",
 	      bridge->name,
-	      (int)((now.tv_sec * 1000000 + now.tv_usec) 
+	      (int)((now.tv_sec * 1000000 + now.tv_usec)
                     - (vnetTime.tv_sec * 1000000 + vnetTime.tv_usec))));
    }
 #  endif
 
    if (bridge->smac) {
-      if (VNetCallSMACFunc(bridge->smac, &skb, skb->mac.raw, 
-                           SMAC_CheckPacketFromHost) != 
+      if (VNetCallSMACFunc(bridge->smac, &skb, compat_skb_mac_header(skb),
+                           SMAC_CheckPacketFromHost) !=
           PacketStatusForwardPacket) {
          LOG(4, (KERN_NOTICE "bridge-%s: packet dropped .\n",
                  bridge->name));
@@ -1392,7 +1399,7 @@
 #endif
 #endif
 
-   skb_push(skb, skb->data - skb->mac.raw);
+   skb_push(skb, skb->data - compat_skb_mac_header(skb));
    LOG(3, (KERN_DEBUG "bridge-%s: receive %d\n",
 	   bridge->name, (int) skb->len));
 
@@ -1416,7 +1423,7 @@
  *
  *      Callback for read operation on this bridge entry in vnets proc fs.
  *
- * Results: 
+ * Results:
  *      Length of read operation.
  *
  * Side effects:
@@ -1433,13 +1440,13 @@
                    int     *eof,    // OUT: TRUE if there is nothing more to read
                    void    *data)   // IN: client data - pointer to bridge
 {
-   VNetBridge *bridge = (VNetBridge*)data; 
+   VNetBridge *bridge = (VNetBridge*)data;
    int len = 0;
 
    if (!bridge) {
       return len;
    }
-   
+
    len += VNetPrintPort(&bridge->port, page+len);
 
    len += sprintf(page+len, "dev %s ", bridge->name);
--- filter.c.old	2007-05-02 13:08:22 +0900
+++ filter.c	2007-11-22 00:39:35 +0900
@@ -10,7 +10,7 @@
 #include <linux/if_ether.h>
 #include <linux/in.h>
 #include <linux/ip.h>
-#include <linux/skbuff.h>
+#include "compat_skbuff.h"
 #include <linux/netdevice.h>
 /*
  * All this makes sense only if NETFILTER support is configured in our kernel.
@@ -229,15 +229,15 @@
    /* When the host receives, hooknum is NF_IP_LOCAL_IN. */
    transmit = (hooknum == NF_IP_POST_ROUTING);
 
-   ip = skb->nh.iph;
-   packetHeader = (uint8 *)ip;
+   packetHeader = compat_skb_network_header(skb);
+   ip = (struct iphdr*)packetHeader;
 
    if (transmit) {
       /* skb all set up for us. */
-      packet = skb->h.raw;
+      packet = compat_skb_transport_header(skb);
    } else {
       /* skb hasn't had a chance to be processed by TCP yet. */
-      packet = skb->nh.raw + (ip->ihl << 2);
+      packet = compat_skb_network_header(skb) + (ip->ihl << 2);
    }
 
    HostFilterPrint(("PacketFilter: IP ver %d ihl %d tos %d len %d id %d\n"
@@ -255,17 +255,21 @@
       packetLength = skb->len - skb->dev->hard_header_len - (ip->ihl << 2);
    } else {
       /*
-       * In certain cases, skb->mac.raw has been observed to be NULL. Don't
+       * In certain cases, compat_skb_mac_header() has been observed to be NULL. Don't
        * know why, but in such cases, this calculation will lead to a negative
        * packetLength, and the packet to be dropped.
        */
-      packetLength = skb->len - (skb->nh.raw - skb->mac.raw) - (ip->ihl << 2);
+      packetLength = skb->len - 
+                     (compat_skb_network_header(skb) - compat_skb_mac_header(skb)) - 
+                     (ip->ihl << 2);
    }
 
    if (packetLength < 0) {
       HostFilterPrint(("PacketFilter: ill formed packet for IPv4\n"));
       HostFilterPrint(("skb: len %d h.raw %p nh.raw %p mac.raw %p, packetLength %d\n",
-                       skb->len, skb->h.raw, skb->nh.raw, skb->mac.raw, packetLength));
+                       skb->len, compat_skb_transport_header(skb),
+                       compat_skb_network_header(skb),
+                       compat_skb_mac_header(skb), packetLength));
       verdict = NF_DROP;
       DropPacket(VNET_FILTER_ACTION_DRP_SHORT, packetHeader, packet, 0);
       goto out_unlock;
######## end patch to fix 6.0.0 vmnet for 2.6.23 kernel
EOT
vmmon-Patch: <<EOT
# Patch to vmmon source for recent 2.6 kernels
--- vmmon-only/Makefile.kernel.old	2005-12-24 08:10:37 +0900
+++ vmmon-only/Makefile.kernel	2006-04-24 21:43:18 +0900
@@ -7,7 +7,7 @@
 ####
 
 vm_check_build = $(shell if $(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_KERNEL) \
-	$(EXTRA_CFLAGS) -Werror -S -o /dev/null -xc $(1) \
+	$(EXTRA_CFLAGS) -DKBUILD_BASENAME="" -S -o /dev/null -xc $(1) \
 	> /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi)
 
 CC_WARNINGS := -Wall -Wstrict-prototypes 
EOT
vmnet-Patch: <<EOT
# Patch to vmnet source for kernel 2.6.x
--- vmnet-only/Makefile.kernel.old	2005-12-24 08:10:37 +0900
+++ vmnet-only/Makefile.kernel	2006-04-24 21:43:18 +0900
@@ -7,7 +7,7 @@
 ####
 
 vm_check_build = $(shell if $(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_KERNEL) \
-	$(EXTRA_CFLAGS) -Werror -S -o /dev/null -xc $(1) \
+	$(EXTRA_CFLAGS) -DKBUILD_BASENAME="" -S -o /dev/null -xc $(1) \
 	> /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi)
 
 CC_WARNINGS := -Wall -Wstrict-prototypes 
--- vmnet-only/driver.c.old	2005-12-24 08:10:37 +0900
+++ vmnet-only/driver.c	2006-04-24 21:47:44 +0900
@@ -1393,7 +1393,7 @@
       return FALSE;
    }
    
-   for (fd = 0; fd < p->files->max_fds; fd++) {
+   for (fd = 0; fd < files_fdtable(p->files)->max_fds; fd++) {
 #ifdef KERNEL_2_3_99
       file = fcheck_files(p->files, fd);
 #else
--- vmnet-only/userif.c.old	2006-04-24 21:44:32 +0900
+++ vmnet-only/userif.c	2006-04-24 21:59:36 +0900
@@ -34,6 +34,15 @@
 #include <net/checksum.h>
 #endif
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
+static int skb_copy_datagram(const struct sk_buff *skb, int offset,
+			     char *to, int size)
+{
+    struct iovec iov = { .iov_base=to, .iov_len=size };
+    return skb_copy_datagram_iovec(skb, offset, &iov, size);
+}
+#endif
+
 #include "vm_oui.h"
 #include "net.h"
 #include "vnet.h"
@@ -162,8 +162,10 @@
 static INLINE int
 VNetUserIfMapUint32Ptr(VA uAddr, struct page **p, uint32 **ptr)
 {
-   if (verify_area(VERIFY_READ, (void *)uAddr, sizeof (uint32)) ||
-       verify_area(VERIFY_WRITE, (void *)uAddr, sizeof (uint32)) ||
+   uint32 dummy;
+
+   if (copy_from_user(&dummy, (void *)uAddr, sizeof (uint32)) ||
+       copy_to_user((void *)uAddr, &dummy, sizeof (uint32)) ||
        (((uAddr + sizeof(uint32)) & ~(PAGE_SIZE - 1)) != 
         (uAddr & ~(PAGE_SIZE - 1)))) {
       return -EINVAL;
--- vmnet-only-orig/vmnetInt.h	2004-06-11 10:31:20 +0900
+++ vmnet-only/vmnetInt.h	2005-09-04 23:50:38 +0900
@@ -33,7 +33,9 @@
 #endif
 
 
-#if defined(KERNEL_2_5_5)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+#   define compat_sk_alloc(_pri) ({ static struct proto p = {.name="vmnet-bridge", .owner=THIS_MODULE}; struct sock *sk = sk_alloc(PF_NETLINK, _pri, &p, 1); if (sk) sock_init_data(NULL,sk); sk; })
+#elif defined(KERNEL_2_5_5)
 #   define compat_sk_alloc(_pri) sk_alloc(PF_NETLINK, _pri, 1, NULL)
 #else
 #   define compat_sk_alloc(_pri) sk_alloc(0, _pri, 1)
EOT

-/etc/vmware/
/etc/rc.d/init.d/vmware
/etc/rc.d/rc?.d/???vmware
/etc/vmware/
/etc/vmware-vix/
/lib/modules/*/misc/vmblock.*
/lib/modules/*/misc/vmmon.*
/lib/modules/*/misc/vmnet.*
/pkg/vmware/
/usr/bin/vmware
/usr/bin/vmware-config.pl
/usr/lib/vmware
/usr/share/man/man1/vmware.1.gz
