Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Apr 2000 23:17:34 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Gary Jennejohn <garyj@muc.de>
Cc:        freebsd-current@FreeBSD.ORG
Subject:   Re: MLEN and crashes 
Message-ID:  <Pine.BSF.4.21.0004032315250.409-100000@alphplex.bde.org>
In-Reply-To: <200004021700.TAA01074@peedub.muc.de>

next in thread | previous in thread | raw e-mail | index | archive | help
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




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