Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Apr 1996 20:05:54 +0000
From:      Poul-Henning Kamp <phk@critter.tfs.com>
To:        current@FreeBSD.org
Cc:        Jim Fleming <JimFleming@unety.net>
Subject:   SLIP: Check IP Version (please test)
Message-ID:  <9458.830289954@critter.tfs.com>
In-Reply-To: Your message of "Sun, 07 Apr 1996 00:28:56 CST." <01BB2419.36344C40@webster.unety.net> 

next in thread | previous in thread | raw e-mail | index | archive | help

Somebody running slip with header compression please test this patch.

Poul-Henning

> I am starting to develop a substantialliy modified version of the IP protocol
.
> As specified in the IP protocol the ip_v (IP Version) field of the IP header
> should be set to 4. (see /usr/src/sys/netinet/ip.h)
> 
> It is not desirable for new versions of IP to "break" existing code. I have n
ot
> provide this but in studying the SLIP code I see that there is never really
> a check done to see of the IP header is of version 4.

Index: if_sl.c
===================================================================
RCS file: /home/ncvs/src/sys/net/if_sl.c,v
retrieving revision 1.37
diff -u -r1.37 if_sl.c
--- if_sl.c	1996/04/07 17:39:09	1.37
+++ if_sl.c	1996/04/23 20:03:53
@@ -561,7 +561,8 @@
 			} while (m1 = m1->m_next);
 		}
 #endif
-		if ((ip = mtod(m, struct ip *))->ip_p == IPPROTO_TCP) {
+		if ((ip = mtod(m, struct ip *))->ip_v == IPVERSION) &&
+		    (ip = mtod(m, struct ip *))->ip_p == IPPROTO_TCP) {
 			if (sc->sc_if.if_flags & SC_COMPRESS)
 				*mtod(m, u_char *) |= sl_compress_tcp(m, ip,
 				    &sc->sc_comp, 1);
--
Poul-Henning Kamp           | phk@FreeBSD.ORG       FreeBSD Core-team.
http://www.freebsd.org/~phk | phk@login.dknet.dk    Private mailbox.
whois: [PHK]                | phk@ref.tfs.com       TRW Financial Systems, Inc.
Future will arrive by its own means, progress not so.



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