SOURCES: VMware-player-vmnet.patch - removed junk
qboosh
qboosh at pld-linux.org
Sun Aug 31 12:10:08 CEST 2008
Author: qboosh Date: Sun Aug 31 10:10:08 2008 GMT
Module: SOURCES Tag: HEAD
---- Log message:
- removed junk
---- Files affected:
SOURCES:
VMware-player-vmnet.patch (1.1 -> 1.2)
---- Diffs:
================================================================
Index: SOURCES/VMware-player-vmnet.patch
diff -u SOURCES/VMware-player-vmnet.patch:1.1 SOURCES/VMware-player-vmnet.patch:1.2
--- SOURCES/VMware-player-vmnet.patch:1.1 Sat Aug 30 19:03:20 2008
+++ SOURCES/VMware-player-vmnet.patch Sun Aug 31 12:10:03 2008
@@ -10,1560 +10,6 @@
return 0;
}
#endif
-diff -Nur old/vmware-any-any-update117d/vmnet-only/bridge.c~ new/vmware-any-any-update117d/vmnet-only/bridge.c~
---- old/vmware-any-any-update117d/vmnet-only/bridge.c~ 1970-01-01 00:00:00.000000000 +0000
-+++ new/vmware-any-any-update117d/vmnet-only/bridge.c~ 2008-08-30 15:57:32.192483250 +0000
-@@ -0,0 +1,1550 @@
-+/* **********************************************************
-+ * Copyright 1998 VMware, Inc. All rights reserved. -- VMware Confidential
-+ * **********************************************************/
-+
-+#include "driver-config.h"
-+
-+#define EXPORT_SYMTAB
-+
-+#include <linux/kernel.h>
-+#include <linux/version.h>
-+#include <linux/sched.h>
-+#ifdef KERNEL_2_2
-+# include <linux/slab.h>
-+#else
-+# include <linux/malloc.h>
-+#endif
-+#include <linux/poll.h>
-+
-+#include <linux/netdevice.h>
-+#include <linux/etherdevice.h>
-+#include <linux/mm.h>
-+#include "compat_skbuff.h"
-+#include <linux/sockios.h>
-+#include "compat_sock.h"
-+
-+#define __KERNEL_SYSCALLS__
-+#include <asm/io.h>
-+
-+#include <linux/proc_fs.h>
-+#include <linux/file.h>
-+#include <linux/ip.h>
-+#include <linux/tcp.h>
-+#include <net/tcp.h>
-+
-+#ifdef CONFIG_NET_RADIO
-+# include <linux/wireless.h>
-+#endif
-+#include "vmnetInt.h"
-+#include "compat_spinlock.h"
-+#include "compat_netdevice.h"
-+#include "vnetInt.h"
-+#include "smac.h"
-+
-+#define VNET_BRIDGE_HISTORY 48
-+
-+/*
-+ * Bytes reserved before start of packet. As Ethernet header has 14 bytes,
-+ * to get aligned IP header we must skip 2 bytes before packet. Not that it
-+ * matters a lot for us, but using 2 is compatible with what newer 2.6.x
-+ * kernels do.
-+ */
-+#ifndef NET_IP_ALIGN
-+#define NET_IP_ALIGN 2
-+#endif
-+
-+#if LOGLEVEL >= 4
-+static struct timeval vnetTime;
-+#endif
-+
-+typedef struct VNetBridge VNetBridge;
-+
-+struct VNetBridge {
-+ 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
-+ struct packet_type pt; // used to add packet handler
-+ Bool enabledPromisc; // track if promisc enabled
-+ Bool warnPromisc; // tracks if warning has been logged
-+ struct sk_buff *history[VNET_BRIDGE_HISTORY]; // avoid duplicate packets
-+ spinlock_t historyLock; // protects 'history'
-+ VNetPort port; // connection to virtual hub
-+ Bool wirelessAdapter; // connected to wireless adapter?
-+ struct SMACState *smac; // device structure for wireless
-+#ifdef VMW_NETDEV_HAS_NET
-+ struct net_device *internalDev;
-+#endif
-+};
-+
-+typedef PacketStatus (* SMACINT SMACFunc)(struct SMACState *, SMACPackets *);
-+
-+static int VNetBridgeUp(VNetBridge *bridge, Bool rtnlLock);
-+static void VNetBridgeDown(VNetBridge *bridge, Bool rtnlLock);
-+
-+static int VNetBridgeNotify(struct notifier_block *this, u_long msg,
-+ void *data);
-+#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);
-+#else
-+static int VNetBridgeReceiveFromDev(struct sk_buff *skb,
-+ struct net_device *dev,
-+ struct packet_type *pt,
-+ struct net_device *real_dev);
-+#endif
-+
-+static void VNetBridgeFree(VNetJack *this);
-+static void VNetBridgeReceiveFromVNet(VNetJack *this, struct sk_buff *skb);
-+static Bool VNetBridgeCycleDetect(VNetJack *this, int generation);
-+static Bool VNetBridgeIsDeviceWireless(struct net_device *dev);
-+static void VNetBridgePortsChanged(VNetJack *this);
-+static int VNetBridgeIsBridged(VNetJack *this);
-+static int VNetBridgeProcRead(char *page, char **start, off_t off,
-+ int count, int *eof, void *data);
-+
-+
-+/*
-+ *----------------------------------------------------------------------
-+ *
-+ * VNetBridgeStartPromisc --
-+ *
-+ * Set IFF_PROMISC on the peer interface.
-+ *
-+ * Results:
-+ * None.
-+ *
-+ * Side effects:
-+ * The peer interface IFF_PROMISC flag may be changed.
-+ *
-+ *----------------------------------------------------------------------
-+ */
-+
-+static void
-+VNetBridgeStartPromisc(VNetBridge *bridge, // IN:
-+ Bool rtnlLock) // IN: Acquire RTNL lock
-+{
-+ 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.
-+ */
-+ if (rtnlLock) {
-+ rtnl_lock();
-+ }
-+ if (!bridge->enabledPromisc && !bridge->wirelessAdapter) {
-+ dev_set_promiscuity(dev, 1);
-+ bridge->enabledPromisc = TRUE;
-+ bridge->warnPromisc = FALSE;
-+ LOG(0, (KERN_NOTICE "bridge-%s: enabled promiscuous mode\n",
-+ bridge->name));
-+ }
-+ if (rtnlLock) {
-+ rtnl_unlock();
-+ }
-+}
-+
-+
-+/*
-+ *----------------------------------------------------------------------
-+ *
-+ * VNetBridgeStopPromisc --
-+ *
-+ * Restore saved IFF_PROMISC on the peer interface.
-+ *
-+ * Results:
-+ * None.
-+ *
-+ * Side effects:
-+ * The peer interface IFF_PROMISC flag may be changed.
-+ *
-+ *----------------------------------------------------------------------
-+ */
-+
-+static void
-+VNetBridgeStopPromisc(VNetBridge *bridge, // IN:
-+ Bool rtnlLock) // IN: Acquire RTNL lock
-+{
-+ struct net_device *dev = bridge->dev;
-+
-+ if (rtnlLock) {
-+ rtnl_lock();
-+ }
-+ if (bridge->enabledPromisc && !bridge->wirelessAdapter) {
-+ dev_set_promiscuity(dev, -1);
-+ bridge->enabledPromisc = FALSE;
-+ LOG(0, (KERN_NOTICE "bridge-%s: disabled promiscuous mode\n",
-+ bridge->name));
-+ }
-+ if (rtnlLock) {
-+ rtnl_unlock();
-+ }
-+}
-+
-+
-+/*
-+ *----------------------------------------------------------------------
-+ *
-+ * VNetBridgeCheckPromisc --
-+ *
-+ * Make sure IFF_PROMISC on the peer interface is set.
-+ *
-+ * This can be called periodically.
-+ *
-+ * Results:
-+ * None.
-+ *
-+ * Side effects:
-+ * Hopefully enables promiscuous mode again if it should have been enabled.
-+ *
-+ *----------------------------------------------------------------------
-+ */
-+
-+static INLINE_SINGLE_CALLER void
-+VNetBridgeCheckPromisc(VNetBridge *bridge)
-+{
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
-+ if (bridge->enabledPromisc && !bridge->wirelessAdapter) {
-+ struct net_device *dev = bridge->dev;
-+ Bool devPromisc = (dev->flags & IFF_PROMISC) != 0;
-+
-+ if (!devPromisc) {
-+ if (!bridge->warnPromisc) {
-+ bridge->warnPromisc = TRUE;
-+ LOG(0, (KERN_NOTICE "bridge-%s: someone disabled promiscuous mode\n"
-+ "Your Ethernet driver is not compatible with VMware's bridged networking.\n",
-+ bridge->name));
-+ }
-+ rtnl_lock();
-+ dev_set_promiscuity(dev, 0);
-+ rtnl_unlock();
-+ }
-+ }
-+#endif
-+}
-+
-+
-+#ifdef VMW_NETDEV_HAS_NET
-+/*
-+ *----------------------------------------------------------------------
-+ *
-+ * VNetBridgeInternalSetup --
-+ *
-+ * Setup callback for our bridge internal device. Nothing to do,
-+ * generic code sets up everything we expect from device.
-+ *
-+ * Results:
-+ * None.
-+ *
-+ * Side effects:
-+ * None.
-+ *
-+ *----------------------------------------------------------------------
-+ */
-+
-+static void
-+VNetBridgeInternalSetup(struct net_device *net)
-+{
-+ /* Do nothing. */
-+}
-+#endif
-+
-+
-+/*
-+ *----------------------------------------------------------------------
-+ *
-+ * VNetBridgeDevCompatible --
-+ *
-+ * Check whether bridge and network device are compatible.
-+ *
-+ * Results:
-+ * Non-zero if device is good enough for bridge. Zero otherwise.
-+ *
-+ * Side effects:
-+ * None.
-+ *
-+ *----------------------------------------------------------------------
-+ */
-+
-+static INLINE_SINGLE_CALLER int
-+VNetBridgeDevCompatible(VNetBridge *bridge, // IN: Bridge
-+ struct net_device *net) // IN: Network device
-+{
-+#ifdef VMW_NETDEV_HAS_NET
-+ if (net->nd_net != bridge->internalDev->nd_net)) {
-+ return 0;
-+ }
-+#endif
-+ return strcmp(net->name, bridge->name) == 0;
-+}
-+
-+
-+/*
-+ *----------------------------------------------------------------------
-+ *
-+ * VNetBridge_Create --
-+ *
-+ * 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:
-+ * Errno. Also returns an allocated jack to connect to,
-+ * NULL on error.
-+ *
-+ * Side effects:
-+ * None.
-+ *
-+ *----------------------------------------------------------------------
-+ */
-+
-+int
-+VNetBridge_Create(char *devName, // IN: name of device (e.g., "eth0")
-+ VNetPort **ret) // OUT: port to virtual hub
-+{
-+ VNetBridge *bridge = NULL;
-+ static unsigned id = 0;
-+ int retval = 0;
-+
-+ *ret = NULL;
-+
-+ /*
-+ * Its an error if device name is empty.
-+ */
-+
-+ if (devName[0] == '\0') {
-+ retval = -EINVAL;
-+ goto out;
-+ }
-+
-+ /*
-+ * Allocate bridge structure
-+ */
-+
-+ bridge = kmalloc(sizeof *bridge, GFP_USER);
-+ if (bridge == NULL) {
-+ retval = -ENOMEM;
-+ goto out;
-+ }
-+ memset(bridge, 0, sizeof *bridge);
-+ spin_lock_init(&bridge->historyLock);
-+ memcpy(bridge->name, devName, sizeof bridge->name);
-+ NULL_TERMINATE_STRING(bridge->name);
-+
-+#ifdef VMW_NETDEV_HAS_NET
-+ bridge->internalDev = compat_alloc_netdev(0, "vmnetX", VNetBridgeInternalSetup);
-+ if (!bridge->internalDev) {
-+ retval = -ENOMEM;
-+ goto out;
-+ }
-+#endif
-+
-+ /*
-+ * Set up notifier for network device state change
-+ */
-+
-+ bridge->notifier.notifier_call = VNetBridgeNotify;
-+ bridge->notifier.priority = 0;
-+ register_netdevice_notifier(&bridge->notifier);
-+
-+ /*
-+ * Try to bring it up
-+ */
-+
-+ retval = VNetBridgeUp(bridge, TRUE);
-+ if (retval == -ENODEV) {
-+ LOG(1, (KERN_DEBUG "bridge-%s: peer interface %s not found, "
-+ "will wait for it to come up\n",
-+ bridge->name, devName));
-+ retval = 0;
-+ }
-+ if (retval != 0) {
-+ goto out;
-+ }
-+
-+ /*
-+ * Initialize jack
-+ */
-+
-+ bridge->port.id = id++;
-+ bridge->port.next = NULL;
-+
-+ bridge->port.jack.peer = NULL;
-+ bridge->port.jack.numPorts = 1;
-+ 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;
-+ bridge->port.jack.procEntry = NULL;
-+ bridge->port.jack.free = VNetBridgeFree;
-+ bridge->port.jack.rcv = VNetBridgeReceiveFromVNet;
-+ 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) {
-+ if (retval == -ENXIO) {
-+ bridge->port.jack.procEntry = NULL;
-+ } else {
-+ goto out;
-+ }
-+ } else {
-+ bridge->port.jack.procEntry->read_proc = VNetBridgeProcRead;
-+ bridge->port.jack.procEntry->data = bridge;
-+ }
-+
-+ /*
-+ * Rest of fields.
-+ */
-+
-+ bridge->port.flags = IFF_RUNNING;
-+
-+ memset(bridge->port.paddr, 0, sizeof bridge->port.paddr);
-+ memset(bridge->port.ladrf, 0, sizeof bridge->port.ladrf);
-+
-+ bridge->port.paddr[0] = VMX86_STATIC_OUI0;
-+ bridge->port.paddr[1] = VMX86_STATIC_OUI1;
-+ bridge->port.paddr[2] = VMX86_STATIC_OUI2;
-+
-+ bridge->port.fileOpRead = NULL;
-+ bridge->port.fileOpWrite = NULL;
-+ bridge->port.fileOpIoctl = NULL;
-+ 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) {
-+ unregister_netdevice_notifier(&bridge->notifier);
-+ }
-+#ifdef VMW_NETDEV_HAS_NET
-+ if (bridge->internalDev) {
-+ compat_free_netdev(bridge->internalDev);
-+ }
-+#endif
-+ kfree(bridge);
-+ }
-+ return retval;
-+}
-+
-+
-+/*
-+ *----------------------------------------------------------------------
-+ *
-+ * VNetBridgeFree --
-+ *
-+ * Disconnect the bridge, unregister from device state
-+ * notifications, remove proc entry, and deallocate struct.
-+ *
-+ * Results:
-+ * None.
-+ *
-+ * Side effects:
-+ * None.
-+ *
-+ *----------------------------------------------------------------------
-+ */
-+
-+void
-+VNetBridgeFree(VNetJack *this) // IN: jack to free
-+{
-+ VNetBridge *bridge = (VNetBridge*)this->private;
-+
-+ if (bridge->dev != NULL) {
-+ VNetBridgeDown(bridge, TRUE);
-+ }
-+
-+ unregister_netdevice_notifier(&bridge->notifier);
-+
-+#ifdef VMW_NETDEV_HAS_NET
-+ if (bridge->internalDev) {
-+ compat_free_netdev(bridge->internalDev);
-+ }
-+#endif
-+
-+ if (this->procEntry) {
-+ VNetProc_RemoveEntry(this->procEntry, NULL);
-+ }
-+
-+ if (bridge->smac){
-+ SMAC_CleanupState(&(bridge->smac));
-+ }
-+
-+ LOG(1, (KERN_DEBUG "bridge-%s: detached\n", bridge->name));
-+ kfree(bridge);
-+}
-+
-+
-+/*
-+ *----------------------------------------------------------------------
-+ *
-+ * VNetCallSMACFunc --
-+ *
-+ * Wrapper for SMAC functions.
-+ *
-+ * Results:
-+ * Packet Status.
-+ *
-+ * Side effects:
-+ * The skb buffer is freed if not succesfull otherwise it points to
-+ * the clone.
-+ *
-+ *----------------------------------------------------------------------
-+ */
-+
-+PacketStatus
-+VNetCallSMACFunc(struct SMACState *state, // IN: pointer to state
-+ struct sk_buff **skb, // IN/OUT: packet to process
-+ void *startOfData, // IN: points to start of data
-+ SMACFunc func) // IN: function to be called
-+{
-+ SMACPackets packets = { {0} };
-+ PacketStatus status;
-+
-+ packets.orig.skb = *skb;
-+ packets.orig.startOfData = startOfData;
-+
-+ status = func(state, &packets);
-+ if (status != PacketStatusForwardPacket) {
-+ dev_kfree_skb(*skb);
-+ return status;
-+ }
-+
-+ if (packets.clone.skb) {
-+ dev_kfree_skb(*skb);
-+ *skb = packets.clone.skb;
-+ }
-+ return status;
-+}
-+
-+
-+/*
-+ *----------------------------------------------------------------------
-+ *
-+ * VNetBridgeReceiveFromVNet --
-+ *
-+ * This jack is receiving a packet from a vnet. This function
-+ * sends down (i.e., out on the host net device) if the packet
-+ * isn't destined for the host, and it sends up (i.e.,
-+ * simulates a receive for the host) if the packet
-+ * satisfies the host's packet filter.
-+ *
-+ * 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:
-+ * None.
-+ *
-+ * Side effects:
-+ * Frees skb. Checks if host device is still using
-+ * promiscuous mode.
-+ *
-+ *----------------------------------------------------------------------
-+ */
-+
-+void
-+VNetBridgeReceiveFromVNet(VNetJack *this, // IN: jack
-+ struct sk_buff *skb) // IN: pkt to receive
-+{
-+ VNetBridge *bridge = (VNetBridge*)this->private;
-+ struct net_device *dev = bridge->dev;
-+ uint8 dest[ETH_ALEN];
-+ struct sk_buff *clone;
-+
-+ LOG(3, (KERN_DEBUG "bridge-%s: transmit %d\n",
-+ bridge->name, (int) skb->len));
-+
-+ if (!dev) {
-+ dev_kfree_skb(skb);
-+ 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);
-+
-+ /*
<<Diff was trimmed, longer than 597 lines>>
---- CVS-web:
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/VMware-player-vmnet.patch?r1=1.1&r2=1.2&f=u
More information about the pld-cvs-commit
mailing list