Bug 86

Summary: Port should not depend on ListenAddress
Product: Portable OpenSSH Reporter: Markus Friedl <markus>
Component: sshdAssignee: Darren Tucker <dtucker>
Status: CLOSED FIXED    
Severity: trivial CC: calestyo, djm, dtucker
Priority: P2    
Version: -current   
Hardware: Other   
OS: Other   
Bug Depends on:    
Bug Blocks: 2360    
Attachments:
Description Flags
sshd: Allow ListenAddress, Port, AddressFamily in any order djm: ok+

Description Markus Friedl 2002-01-30 09:51:39 AEDT
From sshd(8):

Multiple ListenAddress options are permitted. Additionally, any Port options
must precede this option for non port qualified addresses.
Comment 1 Darren Tucker 2015-04-24 13:03:52 AEST
Looking at this since I have been poking around in this code recently.

Isn't this the other way around?  ie ListenAddress depends on Port?

What's the desired behaviour?  Use whatever Port was last specified for each ListenAddress where the port is not specified?  ie

Port 123
ListenAddress 192.168.0.1
Port 345
ListenAddress 192.168.0.2

ends up listening on 192.168.0.1:123 and 192.168.0.2:345 ?
Comment 2 Damien Miller 2015-04-24 13:15:45 AEST
IMO the behaviour I'd expect from:

Port 123
ListenAddress 192.168.0.1
Port 345
ListenAddress 192.168.0.2

is listening on

192.168.0.1:123
192.168.0.1:345
192.168.0.2:123
192.168.0.2:345

regardless of the ordering of directives.

We could do this by recording the listen addresses with port=0 and then expanding it with the full set of recorded ports later.

Darren just pointed out that we do this wrong wrt ListenAddress too
Comment 3 Darren Tucker 2015-04-24 13:27:22 AEST
(In reply to Damien Miller from comment #2)
> Darren just pointed out that we do this wrong wrt ListenAddress too

I think you meant AddressFamily.
Comment 4 Tetsuo Handa 2015-04-24 21:13:56 AEST
I subscribed to this entry, but I can't recall the reason.
Thus, I unsubscribe.

If Markus no longer thinks this as a problem, please close this entry.
Comment 5 Darren Tucker 2015-04-27 10:10:12 AEST
Created attachment 2609 [details]
sshd: Allow ListenAddress, Port, AddressFamily in any order
Comment 6 Darren Tucker 2015-04-29 13:50:15 AEST
Patch has been applied and will be in 6.9.  Thanks.
Comment 7 Christoph Anton Mitterer 2015-11-01 13:39:53 AEDT
Just a minor note:

The release notes for 6.9 seem to wrongly place that change into ssh(1) instead of sshd.


btw: I'd have considered to behaviour described by Damien in comment #2 to be the best solution.
Cause right now, we cannot have one sshd listen to different ports on different addresses, right? :-(
Comment 8 Christoph Anton Mitterer 2015-11-01 13:43:06 AEDT
taking the 2nd paragraph back... I forgot that one can give the port to ListenAddress ;-)
Comment 9 Damien Miller 2021-04-23 14:57:38 AEST
closing resolved bugs as of 8.6p1 release