Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 29 Jun 1996 17:13:44 +0200 (MET DST)
From:      Juergen Lock <nox@jelal.hb.north.de>
To:        alex@fa.tdktca.com (Alex Nash)
Cc:        davidg@Root.COM, jhay@mikom.csir.co.za, nasim!FreeBSD.org!stable@jelal.hb.north.de
Subject:   Re: ipfw (was: Re: lockups.)
Message-ID:  <199606291513.RAA00434@saturn.hb.north.de>
In-Reply-To: <31D446BA.9BDE134@fa.tdktca.com> from Alex Nash at "Jun 28, 96 03:55:22 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
Alex Nash writes:

> > > Nifty trick, I like it.  I just wanted to point out one thing: this
> > > is only necessary if you plan to boot kernels supped before Feb 23,
> > > not 0696.
> > 
> > Umm you are thinking of -current maybe? :)  or my -stable must have
> > had an, errm, interesting problem for quite a while now...
> >
> >  actually no (thanks cvs :), looks like current is also affected:
> 
> You mean -stable.  Yes, as of Monday this week, -current and -stable
> are in sync.

Actually i was talking about the (date of the) struct ip_fw change,
but nevermind.

> As far as accepting both versions: getting the new kernel to accept
> the old struct would be fairly easy, the new ip_fw struct has some
> extensions and two new flags, all easily defaulted.

 like... below? :)
> 
> Alex
 ATB,
	Juergen

Index: /www/usr/home/cvs/src/src/sys/netinet/ip_fw.c
===================================================================
RCS file: /home/cvs/cvs/src/sys/netinet/ip_fw.c,v
retrieving revision 1.14.4.9
diff -u -r1.14.4.9 ip_fw.c
--- ip_fw.c	1996/06/25 03:16:41	1.14.4.9
+++ ip_fw.c	1996/06/29 14:58:29
@@ -600,14 +600,31 @@
 {
 	struct ip_fw *frwl;
 
-	if (m->m_len != sizeof(struct ip_fw)) {
-		dprintf(("ip_fw_ctl: len=%d, want %d\n", m->m_len,
-		    sizeof(struct ip_fw)));
-		return (NULL);
+	static struct ip_fw ftmp64;
+	static int warned;
+	int f_mask = ~IP_FW_F_MASK;
+
+	/* backward compatibility hack for older ipfw(8)... */
+	if (m->m_len == 64 && sizeof(struct ip_fw) == 100) {
+		frwl = mtod(m, struct ip_fw *);
+		bcopy(frwl, &ftmp64, (size_t)64);
+		frwl = &ftmp64;
+		/* old IP_FW_F_MASK */
+		f_mask = ~0xfff;
+		if (!warned) {
+			dprintf(("ip_fw_ctl: old format ip_fw struct (converted), need to update ipfw(8)?\n"));
+			++warned;
+		}
+	} else {
+		if (m->m_len != sizeof(struct ip_fw)) {
+			dprintf(("ip_fw_ctl: len=%d, want %d\n", m->m_len,
+			    sizeof(struct ip_fw)));
+			return (NULL);
+		}
+		frwl = mtod(m, struct ip_fw *);
 	}
-	frwl = mtod(m, struct ip_fw *);
 
-	if ((frwl->fw_flg & ~IP_FW_F_MASK) != 0) {
+	if ((frwl->fw_flg & f_mask) != 0) {
 		dprintf(("ip_fw_ctl: undefined flag bits set (flags=%x)\n",
 		    frwl->fw_flg));
 		return (NULL);





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199606291513.RAA00434>