logging: add square brackets when print raw ipv6 addresses - #477
Merged
Conversation
mkj
reviewed
Jul 23, 2026
mkj
left a comment
Owner
There was a problem hiding this comment.
Thanks, that makes sense. A couple of small things.
Comment on lines
+379
to
+386
| fprintf(stderr, "Connection to %s@%s:%s closed.\n", cli_opts.username, | ||
| /* IPv6 need to be captuled by [] */ | ||
| if (strchr(cli_opts.remotehost, ':') != NULL) { | ||
| fprintf(stderr, "Connection to %s@[%s]:%s closed.\n", cli_opts.username, | ||
| cli_opts.remotehost, cli_opts.remoteport); | ||
| } else { | ||
| fprintf(stderr, "Connection to %s@%s:%s closed.\n", cli_opts.username, | ||
| cli_opts.remotehost, cli_opts.remoteport); | ||
| } |
Owner
There was a problem hiding this comment.
Can skip this change, just now I realised the print never actually worked, I'll sort out removing it in a separate commit. (session_cleanup() has already closed stderr)
Comment on lines
431
to
434
Comment on lines
+125
to
+129
| if (strchr(host, ':') != NULL) { | ||
| snprintf(svr_ses.addrstring, len, "[%s]:%s", host, port); | ||
| } else { | ||
| snprintf(svr_ses.addrstring, len, "%s:%s", host, port); | ||
| } |
Owner
There was a problem hiding this comment.
Looks like indentation isn't right here, should be tabs.
orangepizza
force-pushed
the
ipv6-logging
branch
2 times, most recently
from
July 23, 2026 05:51
2205ff6 to
800c605
Compare
otherwise it'll print malformed ip in log like "Connection to fe80:3221::1:32514 closed"
Owner
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
otherwise it'll print malformed IPv6 address in log like "Connection to fe80:3221::1:32514 closed"
RFC3986 requires literal ipv6 address in hostname context need to be warped in a square brackets