|
|
|
@ -146,7 +146,8 @@ static void print_help(void) |
|
|
|
|
" SOA, SRV, TXT, TLSA, URI, CAA, SVCB, HTTPS\n\n"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static ares_bool_t read_cmdline(int argc, const char **argv, adig_config_t *config) |
|
|
|
|
static ares_bool_t read_cmdline(int argc, const char **argv, |
|
|
|
|
adig_config_t *config) |
|
|
|
|
{ |
|
|
|
|
ares_getopt_state_t state; |
|
|
|
|
int c; |
|
|
|
@ -193,8 +194,8 @@ static ares_bool_t read_cmdline(int argc, const char **argv, adig_config_t *conf |
|
|
|
|
|
|
|
|
|
case 'c': |
|
|
|
|
if (!ares_dns_class_fromstr(&config->qclass, state.optarg)) { |
|
|
|
|
snprintf(config->error, sizeof(config->error), "unrecognized class %s", |
|
|
|
|
state.optarg); |
|
|
|
|
snprintf(config->error, sizeof(config->error), |
|
|
|
|
"unrecognized class %s", state.optarg); |
|
|
|
|
return ARES_FALSE; |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
@ -213,7 +214,8 @@ static ares_bool_t read_cmdline(int argc, const char **argv, adig_config_t *conf |
|
|
|
|
snprintf(config->error, sizeof(config->error), "invalid port number"); |
|
|
|
|
return ARES_FALSE; |
|
|
|
|
} |
|
|
|
|
config->options.tcp_port = (unsigned short)strtol(state.optarg, NULL, 0); |
|
|
|
|
config->options.tcp_port = |
|
|
|
|
(unsigned short)strtol(state.optarg, NULL, 0); |
|
|
|
|
config->options.flags |= ARES_FLAG_USEVC; |
|
|
|
|
config->optmask |= ARES_OPT_TCP_PORT; |
|
|
|
|
break; |
|
|
|
@ -224,17 +226,20 @@ static ares_bool_t read_cmdline(int argc, const char **argv, adig_config_t *conf |
|
|
|
|
snprintf(config->error, sizeof(config->error), "invalid port number"); |
|
|
|
|
return ARES_FALSE; |
|
|
|
|
} |
|
|
|
|
config->options.udp_port = (unsigned short)strtol(state.optarg, NULL, 0); |
|
|
|
|
config->options.udp_port = |
|
|
|
|
(unsigned short)strtol(state.optarg, NULL, 0); |
|
|
|
|
config->optmask |= ARES_OPT_UDP_PORT; |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case ':': |
|
|
|
|
snprintf(config->error, sizeof(config->error), "%c requires an argument", state.optopt); |
|
|
|
|
snprintf(config->error, sizeof(config->error), |
|
|
|
|
"%c requires an argument", state.optopt); |
|
|
|
|
return ARES_FALSE; |
|
|
|
|
|
|
|
|
|
case '?': |
|
|
|
|
default: |
|
|
|
|
snprintf(config->error, sizeof(config->error), "unrecognized option: %c", state.optopt); |
|
|
|
|
snprintf(config->error, sizeof(config->error), |
|
|
|
|
"unrecognized option: %c", state.optopt); |
|
|
|
|
return ARES_FALSE; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -296,10 +301,13 @@ static void print_question(const ares_dns_record_t *dnsrec) |
|
|
|
|
ares_dns_rec_type_t qtype; |
|
|
|
|
ares_dns_class_t qclass; |
|
|
|
|
size_t len; |
|
|
|
|
if (ares_dns_record_query_get(dnsrec, i, &name, &qtype, &qclass) != ARES_SUCCESS) |
|
|
|
|
if (ares_dns_record_query_get(dnsrec, i, &name, &qtype, &qclass) != |
|
|
|
|
ARES_SUCCESS) { |
|
|
|
|
return; |
|
|
|
|
if (name == NULL) |
|
|
|
|
} |
|
|
|
|
if (name == NULL) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
len = strlen(name); |
|
|
|
|
printf(";%s.\t", name); |
|
|
|
|
if (len + 1 < 24) { |
|
|
|
@ -382,7 +390,7 @@ static void print_opt_u16_list(const unsigned char *val, size_t val_len) |
|
|
|
|
/* Jumping over backwards to try to avoid odd compiler warnings */ |
|
|
|
|
c = (unsigned short)val[i]; |
|
|
|
|
u16 |= (unsigned short)((c << 8) & 0xFFFF); |
|
|
|
|
c = (unsigned short)val[i+1]; |
|
|
|
|
c = (unsigned short)val[i + 1]; |
|
|
|
|
u16 |= c; |
|
|
|
|
if (i != 0) { |
|
|
|
|
printf(","); |
|
|
|
@ -620,8 +628,9 @@ static void print_rr(const ares_dns_rr_t *rr) |
|
|
|
|
const ares_dns_rr_key_t *keys = ares_dns_rr_get_keys(rtype, &keys_cnt); |
|
|
|
|
size_t i; |
|
|
|
|
|
|
|
|
|
if (name == NULL) |
|
|
|
|
if (name == NULL) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
len = strlen(name); |
|
|
|
|
|
|
|
|
|