patch for problem with "Bind to port 22 on 0.0.0.0 failed: Address already in use."

Jan Cihlar cihlar at suse.cz
Tue Nov 27 19:37:07 EST 2001


  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 


More information about the openssh-unix-dev mailing list