diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2023-07-15 09:47:16 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2023-07-15 09:47:16 +0200 |
commit | 163bc6d7fc268bdb1c7cc03699f69d0c5cc0b4cd (patch) | |
tree | eec08d80894534fefc488261dfcb9a5c246cb523 /src/tc-socket.c | |
parent | 980784c1917f19bfd2e9b11faca76d14e8589daa (diff) |
New upstream version 4.14upstream/4.14
Diffstat (limited to 'src/tc-socket.c')
-rw-r--r-- | src/tc-socket.c | 31 |
1 files changed, 30 insertions, 1 deletions
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; +} |