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 [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to