Bug 1787

Summary: -g flag has issues with ipv6 (Address already in use)
Product: Portable OpenSSH Reporter: Hatem Nassrat <hnassrat>
Component: sshAssignee: Assigned to nobody <unassigned-bugs>
Status: NEW ---    
Severity: trivial CC: djm
Priority: P2    
Version: 5.3p1   
Hardware: amd64   
OS: Linux   
Attachments:
Description Flags
v6only.diff none

Description Hatem Nassrat 2010-06-22 23:35:17 AEST
Using the -g flag, gives an error, e.g.:

hnassrat@HNASSRAT-LNX1 ~> ssh -vgL 9000:localhost:9000 hatem@nassrat
[...]
debug1: Local connections to *:9000 forwarded to remote address localhost:9000
debug1: Local forwarding listening on 0.0.0.0 port 9000.
debug1: channel 0: new [port listener]
debug1: Local forwarding listening on :: port 9000.
bind: Address already in use

I am not sure if this issue is specific to linux and thus a bug in linux network config, but when it bound to 0.0.0.0 it listens to all interfaces then trying to listen to the ipv6 interface causes it to say bind address already in use. In this case (OpenSSH_5.3p1 Debian-3ubuntu3, OpenSSL 0.9.8k 25 Mar 2009) the error is useless, however with a machine running OpenSSH_4.3p2, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008 it binds to ipv6 first.

In any case the workaround I used, thanks to ssh being awesome and having cool features, is to use the command as follows:

hnassrat@HNASSRAT-LNX1 ~> ssh -4gL 9000:localhost:9000 hatem@nassrat

This maybe another side-effect, but although I specified only listen on ipv4, i would think it will probably listen on all interfaces (thats probably not an ssh bug though).
Comment 1 Damien Miller 2010-06-23 06:18:02 AEST
Created attachment 1883 [details]
v6only.diff

Please try this patch.
Comment 2 Damien Miller 2010-10-12 14:27:56 AEDT
ping - have you had a chance to try the patch I supplied?