Hi,
> I have an add problem with ssh-2.2.0, running under IRIX 6.5.7 and
> compiled with gcc-2.95.2.
There's nothing odd about it. It's known, but unfortunately not properly
documented. http://freeware.sgi.com/Installable/gcc-2.95.2.html in
"Known Bugs" section states:
<quote>
[From Jim Wilson] Gcc does not correctly pass/return structures which
are smaller than 16 bytes and which are not 8 bytes. The problem is very
involved and difficult to fix. It affects a number of other targets
also, but irix6 is affected the most, because it is a 64 bit target, and
4 byte structures are common. The exact problem is that structures are
being padded at the wrong end, e.g. a 4 byte structure is loaded into
the lower 4 bytes of the register when it should be loaded into the
upper 4 bytes of the register.
Gcc is consistent with itself, but not consistent with the SGI C
compiler [and the SGI supplied runtime libraries], so the only failures
that can happen are when there are library functions that take/return
such structures. There are very few such library functions. I can only
recall seeing a few of them: inet_ntoa, inet_aton, inet_lnaof,
inet_netof, and semctl.
A possible workaround: if you have a program that calls inet_ntoa and
friends or semctl, and your kernel supports 64-bit binaries (i.e. uname
-a prints IRIX64 rather than just IRIX),then you may compile with gcc
-mabi=64 to workaround this problem.
</quote>
Unfortunately there're several inaccuracies. To start with inet_aton
isn't affected by "padding feature" as the structure is passed by
reference. Then "workaround" helps semctl *only* and absolutely not
"inet_ntoa and friends." The latter means that compiling with -mabi=64
(i.e. *if* it's an option) won't help in *your* case. For those who
wonder "number of other targets" means all 64-bit big-endian
architectures, i.e. all but Alpha.
> ssh seems to work OK, but I noticed that in the syslog IP addresses
> are sometimes identified correctly but other times the IP
> address is reported as 255.255.255.0.
>
> Aug 22 15:41:24 6E:irixhost sshd[40232]: connection from "128.62.150.45"
> Aug 22 15:41:24 6D:irixhost sshd[42226]: log: Connection from 255.255.255.255 po
> rt 1022
In either case it looks like you're not telling the whole story. It
looks like you have *both* ssh-2.x.x and ssh-1.2.x installed in your
system and have problem with ssh-1.2.x, not ssh-2.x.x as you originally
state. SSH 2.x.x prints correct value because they don't call inet_ntoa
from libc, but the one of their own design. SSH 1.2.x calls one from
libc and it gets screwed up. The bottom line is that it's SSH 1.2.x that
needs to be fixed. You have two options. Implement own inet_ntoa or link
SSH 1.2.x a shim module of following design:
#ifdef __GNUC__
#if _MIPS_SIM == _ABI64
typedef unsigned long reg_t;
#define REG_T
#elif _MIPS_SIM == _ABIN32
typedef unsigned long long reg_t;
#define REG_T
#endif /* _MIPS_SIM */
#ifdef REG_T
reg_t inet_ntoa (reg_t a0)
{ return _inet_ntoa (a0<<32); }
reg_t inet_lnaof (reg_t a0)
{ return _inet_lnaof (a0<<32); }
reg_t inet_netof (reg_t a0)
{ return _inet_netof (a0<<32); }
reg_t inet_makeaddr (reg_t a0, reg_t a1)
{ reg_t _inet_makeaddr ();
return _inet_makeaddr (a0,a1)>>32;
}
#if _MIPS_SIM != _ABI64
reg_t semctl (reg_t a0, reg_t a1, reg_t a2, reg_t a3)
{ return _semctl(a0,a1,a2,a3<<32); }
#endif /* _MIPS_SIM */
#endif /* REG_T */
#endif /* __GNUC__ */
Note that if compiled shim code is appended (with ar command) to
/usr/gnu/gcc/lib/gcc-lib/mips-sgi-irix6.5/2.95.2/[mabi=64/]libgcc.a,
then the
workaround becomes transparent and you won't have to worry about it ever
again. Well, at least till you upgrade the compiler (I've reported this
to SGI and they said that it might appear in next dist, but you never
know).
Andy.