Subject: Re: vmware's vmnet doesn't compile in -current
To: None <current-users@netbsd.org>
From: Bernd Ernesti <netbsd@arresum.inka.de>
List: current-users
Date: 06/16/2001 16:19:42
--R3G7APHDIzY6R/pk
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Sat, Jun 16, 2001 at 11:32:52PM +1200, Duncan McEwan wrote:
> > i wanted to give vmware another try and as i'm running -current, i wanted to 
> > compile the kernel modules first. The problem ist, that vmnet doesn't build 
> > anymore. This is due to the fact that the macro ETHER_MAX_FRAME in 
> > /usr/include/net/if_ether.h changed from
> > 
> > #define ETHER_MAX_FRAME(etype, hasfcs) to 
> > #define ETHER_MAX_FRAME(ifp, etype, hasfcs)
> 
> I just encountered the exact same problem.  I kludged around it temporarily
> by ifdefing out the couple of places in if_hubmod.c where the macro
> HUBMAXPKT was used.  As far as I could see from the comments, they were both
> testing conditions that "should never happen anyway".

I send Mario a private mail which contained a full package for the modules and
the server.  

These two packages needs more work and tests before I can commit them. I hope
I get the time today to do that.
 
Can someone take a look at the patch for this problem and tells me if it is
correct?

Bernd


--R3G7APHDIzY6R/pk
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=patch-ac

$NetBSD$

--- source/vmnet/if_hubvar.h	Tue Apr  3 00:57:57 2001
+++ source/vmnet/if_hubvar.h	Sun Jun 10 11:35:34 2001
@@ -76,4 +76,8 @@
 #define MAKEHUBDEV(d,u)  MAKEPORTDEV(d,0,-1)
 
 #define HUBMINPKT	ETHER_HDR_LEN
-#define HUBMAXPKT	(ETHER_MAX_FRAME(ETHERTYPE_VLAN, 1))
+#if __NetBSD_Version__ >= 105230000
+# define HUBMAXPKT(ifp)	(ETHER_MAX_FRAME(ifp, ETHERTYPE_VLAN, 1))
+#else
+# define HUBMAXPKT	(ETHER_MAX_FRAME(ETHERTYPE_VLAN, 1))
+#endif
--- source/vmnet/if_hubmod.c	Tue Apr  3 22:51:19 2001
+++ source/vmnet/if_hubmod.c	Sun Jun 10 12:31:03 2001
@@ -141,10 +141,18 @@
 {
 	int error = 0, i, j;
 	struct hubdev_softc *sc;
+#if __NetBSD_Version__ >= 105230000
+	struct ifnet *ifp;
+#endif
 	
 	switch (cmd) {
 	case LKM_E_LOAD:
+#if __NetBSD_Version__ >= 105230000
+		ifp->if_mtu = ETHERMTU;
+		if (HUBMAXPKT(ifp) > MCLBYTES) {
+#else
 		if (HUBMAXPKT > MCLBYTES) {
+#endif
 			printf("if_hub: HUBMAXPKT > MCLBYTES\n");
 			return EIO;
 		}
@@ -903,6 +911,9 @@
 	struct hubport_softc *portsc;
 	struct mbuf *m;
 	int error;
+#if __NetBSD_Version__ >= 105230000
+	struct ifnet *ifp;
+#endif
 
 	hubsc = hub_scs[HUBUNIT(dev)];
 	if (hubsc == NULL)
@@ -917,7 +928,12 @@
 	if (uio->uio_resid == 0)
 		return (0);
 
+#if __NetBSD_Version__ >= 105230000
+	ifp = &portsc->port_if;
+	if ((uio->uio_resid < HUBMINPKT) || (uio->uio_resid > HUBMAXPKT(ifp))) {
+#else
 	if ((uio->uio_resid < HUBMINPKT) || (uio->uio_resid > HUBMAXPKT)) {
+#endif
 		HUBDEBUG("if_hub: write: illegal length %d\n", uio->uio_resid);
 		return EIO;
 	}

--R3G7APHDIzY6R/pk--