1
0

Alright, a test struct sockaddr is not needed for inet_pton().

This commit is contained in:
Alexander Andreev 2024-03-30 04:12:51 +04:00
parent 68cb43795b
commit 9288797c03
Signed by: Arav
GPG Key ID: 25969B23DCB5CA34

View File

@ -288,11 +288,10 @@ int parse_argv(int argc, const char **argv, struct options *opts) {
} }
if (command_arg_num == 1) { if (command_arg_num == 1) {
struct sockaddr test = {0}; int r = inet_pton(AF_INET, opts->addr, NULL);
int r = inet_pton(AF_INET, opts->addr, &test);
if (r == -1) if (r == -1)
r = inet_pton(AF_INET6, opts->addr, &test); r = inet_pton(AF_INET6, opts->addr, NULL);
opts->is_alias_passed = r != 1; opts->is_alias_passed = r == 0;
} }
// opts->is_alias_passed = ((opts->addr[0]>>4) & 0xf) != 0x3; // opts->is_alias_passed = ((opts->addr[0]>>4) & 0xf) != 0x3;