diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2023-07-15 09:47:18 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2023-07-15 09:47:18 +0200 |
commit | eac2a2cc668f491c7d265c5fe6c50f51a60c6256 (patch) | |
tree | 87a5f5c9f173123465a6d7ad42a493b070f71348 /src/tc-socket.c | |
parent | 1842e4ff88f93490966398ae9b763f6dba069799 (diff) | |
parent | 163bc6d7fc268bdb1c7cc03699f69d0c5cc0b4cd (diff) |
Update upstream source from tag 'upstream/4.14'
Update to upstream version '4.14'
with Debian dir 714f602a4a45e9e83780cc1f0ad69803d12fe0e6
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; +} |