Jan Cihlar
2001-Nov-27 08:37 UTC
patch for problem with "Bind to port 22 on 0.0.0.0 failed: Address already in use."
Hi,
there is a cosmetic problem in openssh (all versions AFAIK):
When you start sshd with no "ListenAddress" lines in sshd_config, it
tries to bind address "::" (successfuly) and then "0.0.0.0"
and it fails
with "Address already in use". Moreover it can happen that
"0.0.0.0" is in
addr list sooner than "::" so sshd than will listen only on ipv4
address
"0.0.0.0".
I have prepared patch for 3.0.1p1 which should solve both problems - I go
throught the list and when there are both "0.0.0.0" and "::"
on the same
port, I remove "0.0.0.0" from the list.
I have also removed condition from 'error("Bind to ....")'.
When you have
two "ListenAddress" lines in sshd_config, one is wrong and the wrong
one is
tested before the good one, no error is logged.
Can you look on it and maybe include it to next version, please?
Thanks
--
Mgr. Jan Cihlar
developer
---------------------------------------------------------------------
SuSE CR, s.r.o. e-mail: cihlar at suse.cz
Drahobejlova 27 tel:+420 2 96542 373
190 00 Praha 9 fax:+420 2 96542 374
Ceska republika http://www.suse.cz
---------------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openssh-3.0.1p1-addrlist.dif
Type: text/x-diff
Size: 2503 bytes
Desc: not available
Url :
http://lists.mindrot.org/pipermail/openssh-unix-dev/attachments/20011127/bdf097fb/attachment.bin
Pekka Savola
2001-Nov-27 12:37 UTC
patch for problem with "Bind to port 22 on 0.0.0.0 failed: Address already in use."
On Tue, 27 Nov 2001, Jan Cihlar wrote:> there is a cosmetic problem in openssh (all versions AFAIK): > > When you start sshd with no "ListenAddress" lines in sshd_config, it > tries to bind address "::" (successfuly) and then "0.0.0.0" and it fails > with "Address already in use". Moreover it can happen that "0.0.0.0" is in > addr list sooner than "::" so sshd than will listen only on ipv4 address > "0.0.0.0".This is a Linuxism; binding with standard kernel to both '::' and '0.0.0.0' will fail. This is because '::' already accepts IPv4 connections though mapped addresses. Double-binding is not possible as with IPv6. Just work around this by listening to :: only, if you have to. It's best to leave ListenAddress empty. -- Pekka Savola "Tell me of difficulties surmounted, Netcore Oy not those you stumble over and fall" Systems. Networks. Security. -- Robert Jordan: A Crown of Swords