Bug 620 - Address bits are backwards when setting up port forwarding on Solaris/intel
Summary: Address bits are backwards when setting up port forwarding on Solaris/intel
Status: CLOSED INVALID
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: ssh (show other bugs)
Version: 3.6.1p2
Hardware: ix86 Solaris
: P3 major
Assignee: OpenSSH Bugzilla mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-07-17 09:30 AEST by Joe Rhett
Modified: 2004-04-14 12:24 AEST (History)
0 users

See Also:


Attachments
The generated config.h (25.85 KB, text/plain)
2003-07-18 01:40 AEST, Joe Rhett
no flags Details
configure.ac patch (370 bytes, patch)
2003-07-18 04:48 AEST, Joe Rhett
no flags Details | Diff
Test loopback address for sanity. (563 bytes, text/plain)
2003-07-20 00:33 AEST, Darren Tucker
no flags Details
Show htonl() output (211 bytes, text/plain)
2003-09-05 18:29 AEST, Darren Tucker
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Joe Rhett 2003-07-17 09:30:55 AEST
SSH works perfect fine for sessions, scp, sftp and everything else we use it
for, but port forwarding has been broken since 3.4.something...  The local bind
command tries to bind to 1.0.0.127 instead of the proper loopback address.

It wasn't crucial for me, and I got lazy about reporting it while chasing down
other dramas.  I just downloaded the latest source (3.6.1p2) and compiled it and
the problem remains.  Here's the relevant excerpt from ssh -v ...

jrhett@cyclops.elysium.isite.net's password: 
debug1: Authentication succeeded (password).
debug1: Connections to local port 52881 forwarded to remote address medusa:23
debug1: Local forwarding listening on ::1 port 52881.
bind: Cannot assign requested address
debug1: Local forwarding listening on 1.0.0.127 port 52881.
bind: Cannot assign requested address
Comment 1 Darren Tucker 2003-07-17 13:36:21 AEST
What are HAVE_GETADDRINFO and BROKEN_GETADDRINFO set to in config.h?
Comment 2 Joe Rhett 2003-07-18 01:38:17 AEST
#define HAVE_STRUCT_ADDRINFO 1

/* getaddrinfo is broken (if present) */
/* #undef BROKEN_GETADDRINFO */
Comment 3 Joe Rhett 2003-07-18 01:40:03 AEST
Created attachment 357 [details]
The generated config.h

This is the entire generated config.h from my system, which is Solaris 8, x86.
Comment 4 Darren Tucker 2003-07-18 02:02:02 AEST
You do have #define HAVE_GETADDRINFO 1.  Try defining BROKEN_GETADDRINFO in 
config.h and recompiling.

It looks like Solaris/Intel might have an endian problem in getaddrinfo.
Comment 5 Joe Rhett 2003-07-18 03:02:11 AEST
Changing that config.h parameter solved the problem.  Thanks!

FYI: this is somewhat funny, because Eric? and I had to solve this problem back
in the original SSH 5 or so years ago... it just keeps coming up ;-)

Anyway, can you guys come up with a patch or do you want me to dig around and
come up with one?  I'm fine with headers and such, but I really haven't gotten
my head around autoconf at all so you'll have to lead me around by the nose.
Comment 6 Joe Rhett 2003-07-18 04:48:20 AEST
Created attachment 358 [details]
configure.ac patch

Keep in mind that I'm not really good at autoconf, so this may be the
absolutely wrong way to do this .. but here is a possible patch for
configure.ac that would seem likely to address the problem.
Comment 7 Darren Tucker 2003-07-18 13:40:27 AEST
We can put a work-around in OpenSSH but why don't you report the problem to Sun 
too so they can actually fix it?  
Comment 8 Darren Tucker 2003-07-19 20:44:44 AEST
Fix applied, thanks.
You should report the getaddrinfo problem to Sun, though.
Comment 9 Damien Miller 2003-07-19 23:13:49 AEST
Would it be possible to write a test program to determine whether a given
platform has this bug? This would be preferable to unconditionally defining
BROKEN_GETADDRINFO as that effectively disables IPv6 support, which is a
somewhat high price to pay...
Comment 10 Darren Tucker 2003-07-20 00:31:40 AEST
It should be possible to detect this at build time.
Does the attached stand-alone test detect the problem on Solaris/x86?
Comment 11 Darren Tucker 2003-07-20 00:33:04 AEST
Created attachment 359 [details]
Test loopback address for sanity.
Comment 12 Darren Tucker 2003-07-22 23:00:18 AEST
Hmm, this is a know Solaris/x86 bug (Sun bug #4356490, patch #111328-01).

I think the patch should just be backed out.  The problem isn't fatal and as
Damien pointed out it can break previously working functionality.  If you want
it to work right then hack config.h yourself or fix yer system :-)
Comment 13 Damien Miller 2003-07-23 14:14:01 AEST
yeah, back it out. Is the patch in the standard, recommended patch cluster from Sun?
Comment 14 Darren Tucker 2003-07-23 14:37:11 AEST
Have backed out the changes.  The patch I mentioned is part of the recomended 
patch cluster for Solaris/x86.
Comment 15 Joe Rhett 2003-07-23 23:22:53 AEST
Woah, hold it there.  The system on which this problem was found and reported
from has 111328-04 installed (we are current on all Recommended patches) and the
problem still occurred.

While I agree that this could and should be fixed in the Solaris headers, the
fix should at least be known. The patch you've mentioned does not fix it.  
Comment 16 Darren Tucker 2003-07-23 23:46:55 AEST
The Sun bug describes the problem you're having exactly:
[quote]
The following programs prints an unexpected result on S8/Intel:
[snip]
                   straddr: 1.0.0.127
[/quote]

So it looks like the fix has regressed between 111328-01 and 111328-04.

Does attachment id #359 detect the problem on your system?  Have you reported 
the problem to Sun?
Comment 17 Darren Tucker 2003-09-05 13:24:54 AEST
Reminder: we need to know if we can detect this at build time so we can set
BROKEN_GETADDRINFO where necessary.  Does attachment #359 [details] detect the problem on
Solaris/x86?
Comment 18 Joe Rhett 2003-09-05 15:59:18 AEST
It seems to think so:

% gcc -lsocket -o test test.c
% ./test
Loopback sane


Sorry for the delay
Comment 19 Joe Rhett 2003-09-05 16:01:55 AEST
Er, it seems to think not.  Sorry.
Comment 20 Darren Tucker 2003-09-05 18:29:43 AEST
Created attachment 384 [details]
Show htonl() output

Maybe the problem is in the htonl() macro?  What does the attached program
give?

On Solaris/SPARC (bigendian) I get:
htonl 7f000001
ntohl 7f000001

On an Linux/i386 (little endian) I get:
htonl 100007f
ntohl 100007f

Your Solaris/x86 box should give the same results as Linux, however I suspect
it will give the same as the SPARC.
Comment 21 Joe Rhett 2003-09-05 18:39:18 AEST
Nope, it seems to mirror Linux:

% ./test
htonl 100007f
ntohl 100007f
Comment 22 Joe Rhett 2003-09-06 01:21:46 AEST
Bug is not a bug.  Problem was tester, not test.
Comment 23 Damien Miller 2004-04-14 12:24:19 AEST
Mass change of RESOLVED bugs to CLOSED