Call for testing for 3.5 OpenSSH

Wendy Palm wendyp at cray.com
Wed Sep 25 06:38:40 EST 2002


Ben Lindstrom wrote:
> 
> On Tue, 24 Sep 2002, Michael Tokarev wrote:
> 
> > Ben Lindstrom wrote:
> >
> > []
> > >>*** 101,111 ****
> > >>--- 101,119 ----
> > >>        if (h == NULL) {
> > >>                debug("Installing crc compensation attack detector.");
> > >>                n = l;
> > >>+ #if defined(_CRAY) && !defined(_CRAYSV2)
> > >>+               h = (u_int16_t *) xmalloc(n * sizeof(u_int16_t));
> > >>+ #else
> > >>                h = (u_int16_t *) xmalloc(n * HASH_ENTRYSIZE);
> > >>+ #endif /* _CRAY */
> > >>        } else {
> > >>                if (l > n) {
> > >>                        n = l;
> > >>+ #if defined(_CRAY) && !defined(_CRAYSV2)
> > >>+                       h = (u_int16_t *) xrealloc(h, n * sizeof(u_int16_t));
> > >>+ #else
> > >>                        h = (u_int16_t *) xrealloc(h, n * HASH_ENTRYSIZE);
> > >>+ #endif /* _CRAY */
> >
> > etc etc.  I think this way will be *much* simpler:
> >
> > #if defined(_CRAY) && ! defined(_CRAYSV2)
> >   #include <ia.h>
> >   #define HASH_ENTRYSIZE sizeof(u_int16_t)
> >   #define HASH_UNUSEDCHAR (HASH_UNUSED>>8)
> > #endif /* _CRAY */
> >
> > and just forgot about this whole hunk?
> >
> 
> No.. If I'm not mistaken (Please, Wendy correct me if I'm wrong) there
> are other aspects of the code where the #define's are correct.  And
> that is part of the issue here.  This has been talked about over the last
> year or so.

i just gave it a try.  replacing the 2 sections mentioned above with the
# define HASH_ENTRYSIZE sizeof(u_int16_t)
seems to work fine.  however, the memset still doesn't work for a cray, 
so that needs to be left as the for loop.

cray has 64 bit ints, so if HASH_UNUSED is 0xffff, then shift it 8
ends up with 0xff, which is the same as HASH_UNUSEDCHAR.
so i see that really the for loop should be
#ifdef _UNICOS
        for (i=0; i<n; i++) h[i] = HASH_UNUSEDCHAR;
but that's moot anyway.

i can't figure out right now what's wrong with the memset call, but it's
not working on a cray.  it's got to be something with 8 bit chars and
64bit HASH_ENTRYSIZE.

> 
> > Also, instead of repeating "#if defined(_CRAY) && ! defined(_CRAYSV2)",
> > will it be better to use something like
> >
> > #if defined(_CRAY) && ! defined(_CRAYSV2)
> > # define _CRAY_IA
> > #endif
> >
> > and use #if _CRAY_IA (or whatether) in the rest of places?
> >
> 
> Would be better if we could do #ifdef HAVE_XXX  and not have to handle it
> the current way.  However, if it can't be done I'd rather see the
> Defines() && !define() instead of go digging around looking for this
> mythical '_CRAY_IA'.  From a coding view point it is a one off operation
> and makes it hard to track code.
> 
> - Ben

i know this crossed emails, but i'll include it here for completeness.
the whole
#if defined(_CRAY) && !defined(_CRAYSV2) 
can now be replaced with
#ifdef _UNICOS

i'd be happy to create a patch with all the changes.

-- 
wendy palm
Cray OS Sustaining Engineering, Cray Inc.
wendyp at cray.com, 651-605-9154



More information about the openssh-unix-dev mailing list