mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-12 13:58:58 -04:00
reformat weird indentation in dns tests
svn:r1478
This commit is contained in:
parent
3c2198cb48
commit
9976f1e74c
@ -224,52 +224,51 @@ dns_server_request_cb(struct evdns_server_request *req, void *data)
|
|||||||
"a.a.a.a." "0.0.0.0." "0.0.0.0." "0.f.f.f.ip6.arpa";
|
"a.a.a.a." "0.0.0.0." "0.0.0.0." "0.f.f.f.ip6.arpa";
|
||||||
|
|
||||||
for (i = 0; i < req->nquestions; ++i) {
|
for (i = 0; i < req->nquestions; ++i) {
|
||||||
|
const int qtype = req->questions[i]->type;
|
||||||
|
const int qclass = req->questions[i]->dns_question_class;
|
||||||
|
const char *qname = req->questions[i]->name;
|
||||||
|
|
||||||
struct in_addr ans;
|
struct in_addr ans;
|
||||||
ans.s_addr = htonl(0xc0a80b0bUL); /* 192.168.11.11 */
|
ans.s_addr = htonl(0xc0a80b0bUL); /* 192.168.11.11 */
|
||||||
if (req->questions[i]->type == EVDNS_TYPE_A &&
|
if (qtype == EVDNS_TYPE_A &&
|
||||||
req->questions[i]->dns_question_class == EVDNS_CLASS_INET &&
|
qclass == EVDNS_CLASS_INET &&
|
||||||
!evutil_ascii_strcasecmp(req->questions[i]->name, "zz.example.com")) {
|
!evutil_ascii_strcasecmp(qname, "zz.example.com")) {
|
||||||
r = evdns_server_request_add_a_reply(req,
|
r = evdns_server_request_add_a_reply(req, qname,
|
||||||
req->questions[i]->name,
|
1, &ans.s_addr, 12345);
|
||||||
1, &ans.s_addr, 12345);
|
|
||||||
if (r<0)
|
if (r<0)
|
||||||
dns_ok = 0;
|
dns_ok = 0;
|
||||||
} else if (req->questions[i]->type == EVDNS_TYPE_AAAA &&
|
} else if (qtype == EVDNS_TYPE_AAAA &&
|
||||||
req->questions[i]->dns_question_class == EVDNS_CLASS_INET &&
|
qclass == EVDNS_CLASS_INET &&
|
||||||
!evutil_ascii_strcasecmp(req->questions[i]->name, "zz.example.com")) {
|
!evutil_ascii_strcasecmp(qname, "zz.example.com")) {
|
||||||
char addr6[17] = "abcdefghijklmnop";
|
char addr6[17] = "abcdefghijklmnop";
|
||||||
r = evdns_server_request_add_aaaa_reply(req,
|
r = evdns_server_request_add_aaaa_reply(req,
|
||||||
req->questions[i]->name,
|
qname, 1, addr6, 123);
|
||||||
1, addr6, 123);
|
|
||||||
if (r<0)
|
if (r<0)
|
||||||
dns_ok = 0;
|
dns_ok = 0;
|
||||||
} else if (req->questions[i]->type == EVDNS_TYPE_PTR &&
|
} else if (qtype == EVDNS_TYPE_PTR &&
|
||||||
req->questions[i]->dns_question_class == EVDNS_CLASS_INET &&
|
qclass == EVDNS_CLASS_INET &&
|
||||||
!evutil_ascii_strcasecmp(req->questions[i]->name, TEST_ARPA)) {
|
!evutil_ascii_strcasecmp(qname, TEST_ARPA)) {
|
||||||
r = evdns_server_request_add_ptr_reply(req, NULL,
|
r = evdns_server_request_add_ptr_reply(req, NULL,
|
||||||
req->questions[i]->name,
|
qname, "ZZ.EXAMPLE.COM", 54321);
|
||||||
"ZZ.EXAMPLE.COM", 54321);
|
|
||||||
if (r<0)
|
if (r<0)
|
||||||
dns_ok = 0;
|
dns_ok = 0;
|
||||||
} else if (req->questions[i]->type == EVDNS_TYPE_PTR &&
|
} else if (qtype == EVDNS_TYPE_PTR &&
|
||||||
req->questions[i]->dns_question_class == EVDNS_CLASS_INET &&
|
qclass == EVDNS_CLASS_INET &&
|
||||||
!evutil_ascii_strcasecmp(req->questions[i]->name, TEST_IN6)){
|
!evutil_ascii_strcasecmp(qname, TEST_IN6)){
|
||||||
r = evdns_server_request_add_ptr_reply(req, NULL,
|
r = evdns_server_request_add_ptr_reply(req, NULL,
|
||||||
req->questions[i]->name,
|
qname,
|
||||||
"ZZ-INET6.EXAMPLE.COM", 54322);
|
"ZZ-INET6.EXAMPLE.COM", 54322);
|
||||||
if (r<0)
|
if (r<0)
|
||||||
dns_ok = 0;
|
dns_ok = 0;
|
||||||
} else if (req->questions[i]->type == EVDNS_TYPE_A &&
|
} else if (qtype == EVDNS_TYPE_A &&
|
||||||
req->questions[i]->dns_question_class == EVDNS_CLASS_INET &&
|
qclass == EVDNS_CLASS_INET &&
|
||||||
!evutil_ascii_strcasecmp(req->questions[i]->name, "drop.example.com")) {
|
!evutil_ascii_strcasecmp(qname, "drop.example.com")) {
|
||||||
if (evdns_server_request_drop(req)<0)
|
if (evdns_server_request_drop(req)<0)
|
||||||
dns_ok = 0;
|
dns_ok = 0;
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
printf("Unexpected question %d %d \"%s\" ",
|
printf("Unexpected question %d %d \"%s\" ",
|
||||||
req->questions[i]->type,
|
qtype, qclass, qname);
|
||||||
req->questions[i]->dns_question_class,
|
|
||||||
req->questions[i]->name);
|
|
||||||
dns_ok = 0;
|
dns_ok = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -318,7 +317,7 @@ dns_server_gethostbyname_cb(int result, char type, int count, int ttl,
|
|||||||
struct in6_addr *in6_addrs = addresses;
|
struct in6_addr *in6_addrs = addresses;
|
||||||
char buf[INET6_ADDRSTRLEN+1];
|
char buf[INET6_ADDRSTRLEN+1];
|
||||||
if (memcmp(&in6_addrs[0].s6_addr, "abcdefghijklmnop", 16)
|
if (memcmp(&in6_addrs[0].s6_addr, "abcdefghijklmnop", 16)
|
||||||
|| ttl != 123) {
|
|| ttl != 123) {
|
||||||
const char *b = inet_ntop(AF_INET6, &in6_addrs[0],buf,sizeof(buf));
|
const char *b = inet_ntop(AF_INET6, &in6_addrs[0],buf,sizeof(buf));
|
||||||
printf("Bad IPv6 response \"%s\" %d. ", b, ttl);
|
printf("Bad IPv6 response \"%s\" %d. ", b, ttl);
|
||||||
dns_ok = 0;
|
dns_ok = 0;
|
||||||
@ -352,7 +351,6 @@ dns_server_gethostbyname_cb(int result, char type, int count, int ttl,
|
|||||||
printf("Bad response type %d. ", type);
|
printf("Bad response type %d. ", type);
|
||||||
dns_ok = 0;
|
dns_ok = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if (++n_server_responses == 3) {
|
if (++n_server_responses == 3) {
|
||||||
event_loopexit(NULL);
|
event_loopexit(NULL);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user