From owner-freebsd-current Mon Apr 3 6:18: 9 2000 Delivered-To: freebsd-current@freebsd.org Received: from gidora.zeta.org.au (gidora.zeta.org.au [203.26.10.25]) by hub.freebsd.org (Postfix) with SMTP id 9DB2137BD20 for ; Mon, 3 Apr 2000 06:18:00 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: (qmail 23327 invoked from network); 3 Apr 2000 13:17:53 -0000 Received: from bde.zeta.org.au (203.2.228.102) by gidora.zeta.org.au with SMTP; 3 Apr 2000 13:17:53 -0000 Date: Mon, 3 Apr 2000 23:17:34 +1000 (EST) From: Bruce Evans X-Sender: bde@alphplex.bde.org To: Gary Jennejohn Cc: freebsd-current@FreeBSD.ORG Subject: Re: MLEN and crashes In-Reply-To: <200004021700.TAA01074@peedub.muc.de> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Sun, 2 Apr 2000, Gary Jennejohn wrote: > Bruce Evans writes: > >Big structs need to be malloced. > > Yes, but how does one know that a struct is too big ? Before the increase > in MLEN strucct sppp was not too big. All structs should be considered too big until proven otherwise :-). > >I think removing the unused bloat in `struct cstate' is the correct fix > >for this particular allocation. > > > > I think we should nuke csu_hdr since it's not used anywhere. Is that > what you really mean ? Yes. I'm trying the following patch. Only tested at compile time. diff -c2 slcompress.h~ slcompress.h *** slcompress.h~ Sun Aug 29 13:15:00 1999 --- slcompress.h Sun Apr 2 21:53:35 2000 *************** *** 41,46 **** #define _NET_SLCOMPRESS_H_ ! #define MAX_STATES 16 /* must be > 2 and < 256 */ ! #define MAX_HDR MLEN /* XXX 4bsd-ism: should really be 128 */ /* --- 41,46 ---- #define _NET_SLCOMPRESS_H_ ! #define MAX_STATES 16 /* must be > 2 and < 256 */ ! #define MAX_HDR 128 /* *************** *** 120,130 **** u_char cs_id; /* connection # associated with this state */ u_char cs_filler; ! union { ! char csu_hdr[MAX_HDR]; ! struct ip csu_ip; /* ip/tcp hdr from most recent packet */ ! } slcs_u; }; - #define cs_ip slcs_u.csu_ip - #define cs_hdr slcs_u.csu_hdr /* --- 120,125 ---- u_char cs_id; /* connection # associated with this state */ u_char cs_filler; ! struct ip cs_ip; /* ip/tcp hdr from most recent packet */ }; /* Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message