This is a discussion on Re: port forwarding trouble within the OpenSSH Development forums, part of the Networking and Network Related category; * Darren Tucker [2005-08-11 00:35:10 +1000]: > It occurrs to me that since it doesn't actually ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
* Darren Tucker [2005-08-11 00:35:10 +1000]:
> It occurrs to me that since it doesn't actually need *parse* the > host:port identifiers then factoring out that code is a waste of time, > so this diff is much simpler :-) Remind me: why do you need to check for the second ':' before deciding to use square brackets? As far as avoiding ambiguity is concerned, I would argue that even a single ':' in the host string is enough to warrant bracketing. It is true that an IPv6 address cannot be written with less than two ':'. What I don't see right now is under what other circumstances host could contain a single ':'. If, as I believe, it cannot, then you might as well drop the second strchr() call. And even if it can, bracketing may still be appropriate. Isn't the reason for your two-':' heuristic that ListenAddress lines can already be in host:port form? I don't think that's an issue here. > + if ((p = strchr(host, ':')) != NULL && strchr(p+1, ':') != NULL) > + ret = asprintf(&p, "[%s]:%hd", host, port); /* IPv6 */ > + else > + ret = asprintf(&p, "%s:%hd", host, port); _______________________________________________ openssh-unix-dev mailing list openssh-unix-dev@mindrot.org http://www.mindrot.org/mailman/listi...enssh-unix-dev |
![]() |
| Thread Tools | |
| Display Modes | |
|
|