Skip to content

Commit

Permalink
clients/upsclient.c: comment about bracketed IP addresses/host names [n…
Browse files Browse the repository at this point in the history
…etworkupstools#2512]

Signed-off-by: Jim Klimov <[email protected]>
  • Loading branch information
jimklimov committed Jul 8, 2024
1 parent 0188c2f commit 4007156
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions clients/upsclient.c
Original file line number Diff line number Diff line change
Expand Up @@ -1700,6 +1700,10 @@ int upscli_splitaddr(const char *buf, char **hostname, uint16_t *port)
}

if (*tmp == '[') {
/* NOTE: Brackets are required for colon-separated IPv6
* addresses, to differentiate from a port number. For
* example, `[1234:5678]:3493` would seem right.
*/
if (strchr(tmp, ']') == NULL) {
fprintf(stderr, "upscli_splitaddr: missing closing bracket in [domain literal]\n");
return -1;
Expand Down

0 comments on commit 4007156

Please sign in to comment.