From 163bc6d7fc268bdb1c7cc03699f69d0c5cc0b4cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sat, 15 Jul 2023 09:47:16 +0200 Subject: New upstream version 4.14 --- src/tc-socket.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'src/tc-socket.c') diff --git a/src/tc-socket.c b/src/tc-socket.c index 9904ba8..3cdeb90 100644 --- a/src/tc-socket.c +++ b/src/tc-socket.c @@ -12,12 +12,30 @@ #ifndef AI_V4MAPPED # define AI_V4MAPPED 0 #endif +#include "internal.h" -int main(void) +static int t_parse(void) +{ + char host[32] = "bogus"; + if (HX_addrport_split("[::1]", host, sizeof(host), nullptr) != 1 || + strcmp(host, "::1") != 0) + return 1; + if (HX_addrport_split("[]", host, sizeof(host), nullptr) != 1 || + strcmp(host, "") != 0) + return 1; + if (HX_addrport_split("", host, sizeof(host), nullptr) != 1 || + strcmp(host, "") != 0) + return 1; + return 0; +} + +static int t_local(void) { static const char *addrs[] = { "::1", "::2", "::ffff:127.0.0.1", "::", + "[::1]", "[::2]", "[::ffff:127.0.0.1]", "[::]", "127.0.0.1", "127.0.0.2", "1.1.1.1", "255.255.255.255", + "[127.0.0.1]", "[127.0.0.2]", "[1.1.1.1]", "[255.255.255.255]", }; for (size_t i = 0; i < ARRAY_SIZE(addrs); ++i) { char host[32] = {}; @@ -73,3 +91,14 @@ int main(void) } return EXIT_SUCCESS; } + +int main(void) +{ + int ret = t_parse(); + if (ret != 0) + return ret; + ret = t_local(); + if (ret != EXIT_SUCCESS) + return ret; + return EXIT_SUCCESS; +} -- cgit v1.2.3