dropbear icon indicating copy to clipboard operation
dropbear copied to clipboard

Change port separator to semicolon : since it's more standard

Open david-alvarez-rosa opened this issue 2 years ago • 4 comments

Kindly suggesting to switch to semicolon character : as port separator as [user@]hostname[:port]. Current port separator is ^ which is less standard -- semicolon is used both in ssh and scp programs.

For maintaining backward compatibility, similar to the support of legacy /, the character ^ can still be supported.

Appendix

A bit of history:

  • From what I've been able to understand from Git history, everything started in 2008 with the usage of / as port separator, implemented in 1.

  • Five years later, in 2013, This was changed 2 to # to fix a problem related to scp. Not sure, but a plausible reason for this could be a clash with the usage of / for directories. Note that the usage of / was still allowed as legacy.

  • That same year it was changed again 3 to % for some reason I have not been able to understand.

  • Then, in 2014, since % is used by IPv6 addresses, this was changed 4 to use ^ as port separator -- and this is the current state.

As a comment, / is still supported as legacy.

david-alvarez-rosa avatar Mar 10 '23 15:03 david-alvarez-rosa

My bad, just noticed that : is called colon (not semicolon). Will fix in rev. 2 if approach is validated :)

david-alvarez-rosa avatar Mar 24 '23 13:03 david-alvarez-rosa

The syntax here is only for multihop, which OpenSSH added later with their -J option, the syntax being a little bit different.

I think the reason I avoided : was because it is used for ipv6 separators. I guess that should be OK if it can handle the standard [] quoting, maybe by using split_address_port() https://github.com/mkj/dropbear/blob/7f80432ea6aa7bb25ce8043169be15052ac22f78/src/common-runopts.c#L128

I can't remember exactly but assume the reason # was removed was because it was hard to type without it being treated as a shell comment. / being treated as a directory separator sounds likely.

mkj avatar Apr 26 '23 14:04 mkj

I believe the : was avoided because of the scp use for specifying the destination filename/path like scp -P port user@host:filename if you do multihops with different ports you will get : scp user@host1:2022,user@host2:3022:filename instead of scp user@host1^2022,user@host2^3022:filename But I might be wrong

HansH111 avatar Jan 31 '24 09:01 HansH111

I believe the : was avoided because of the scp use for specifying the destination filename/path like scp -P port user@host:filename

Ah yes, I think that's right. So even with [] for ipv6, a colon might be problematic.

mkj avatar Mar 31 '24 04:03 mkj