Subject: Re: CVS commit: src/sys
To: None <tech-net@NetBSD.org>
From: David Young <dyoung@pobox.com>
List: tech-net
Date: 05/29/2007 17:34:39
On Tue, May 29, 2007 at 05:20:33PM -0500, David Young wrote:
> On Tue, May 29, 2007 at 09:32:31PM +0000, Christos Zoulas wrote:
> > 
> > Module Name:	src
> > Committed By:	christos
> > Date:		Tue May 29 21:32:31 UTC 2007
> > 
> > Modified Files:
> > 	src/sys/net: bpf.c if.c if.h if_etherip.c if_ethersubr.c if_gre.c
> > 	    if_media.c if_tap.c

I believe such a change should have been sent to tech-net@ for review
before it was committed.

It looks like you have made unrelated changes to if_ethersubr.c 
and if_tap.c, which you have not described in the commit message.

You repeat this code all over:

+#if defined(COMPAT_09) || defined(COMPAT_10) || defined(COMPAT_11) || \
+    defined(COMPAT_12) || defined(COMPAT_13) || defined(COMPAT_14) || \
+    defined(COMPAT_15) || defined(COMPAT_16) || defined(COMPAT_20) || \
+    defined(COMPAT_30) || defined(COMPAT_40)
+#include <compat/sys/sockio.h>
+#endif

Please, move the #ifdef inside of compat/sys/sockio.h, or at least
encapsulate the condition in a #define.  People have to read this code.

Finally, gre(4) has grown this wart---no, thank you:

Index: src/sys/net/if_gre.c
diff -u src/sys/net/if_gre.c:1.93 src/sys/net/if_gre.c:1.94
--- src/sys/net/if_gre.c:1.93	Sun May  6 02:47:52 2007
+++ src/sys/net/if_gre.c	Tue May 29 21:32:30 2007
@@ -894,13 +902,26 @@
 	struct sockaddr_in dst, src;
 	struct proc *p = curproc;	/* XXX */
 	struct lwp *l = curlwp;	/* XXX */
-	struct ifreq *ifr = (struct ifreq *)data;
+	struct ifreq *ifr;
 	struct if_laddrreq *lifr = (struct if_laddrreq *)data;
 	struct gre_softc *sc = ifp->if_softc;
 	struct sockaddr_in si;
 	struct sockaddr *sa = NULL;
 	int error = 0;
-
+	u_long ocmd = cmd;
+#ifdef COMPAT_OIFREQ
+	struct oifreq *oifr;
+	struct ifreq ifrb;
+
+	cmd = cvtcmd(cmd);
+	if (cmd != ocmd) {
+		oifr = data;
+		data = ifr = &ifrb;
+		ifreqo2n(oifr, ifr);
+	} else
+#endif
+		ifr = data;
+	
 	switch (cmd) {
 	case SIOCSIFFLAGS:
 	case SIOCSIFMTU:
@@ -1156,6 +1177,10 @@
 		error = EINVAL;
 		break;
 	}
+#ifdef COMPAT_OIFREQ
+	if (cmd != ocmd)
+		ifreqn2o(oifr, ifr);
+#endif
 	mutex_exit(&sc->sc_mtx);
 	return error;
 }

Dave

-- 
David Young             OJC Technologies
dyoung@ojctech.com      Urbana, IL * (217) 278-3933 ext 24