Bug 3485

Summary: Allow percent expansion in Forward host (and port?) in addition to path
Product: Portable OpenSSH Reporter: Mattthijs Tadema <M.J.Tadema>
Component: sshAssignee: Assigned to nobody <unassigned-bugs>
Status: NEW ---    
Severity: enhancement    
Priority: P5    
Version: 9.1p1   
Hardware: amd64   
OS: Linux   

Description Mattthijs Tadema 2022-10-19 09:01:11 AEDT
I was trying to use percent expansion in a LocalForward directive to dynamically change the listening hostname based on the hostname that I was connecting to, and realized that this was not possible. In the man pages for ssh_config it does mention that the expansion only works for Unix domain socket paths, though near the end in the TOKENS section it briefly mentions percent expansion works for LocalForward in general, hence my confusion.
I went looking through the code and noticed that it seems like the choice was made deliberately to only expand paths and not the hosts and ports too.
I realize that my usecase might be too specific, and I could not find anybody else complaining about this particular "problem" so perhaps I'm the only one, but I think it would be nice to have this feature.
If there is a good reason for not percent expanding forward hosts (and ports) please let me know.

Best regards,
Matthijs