Skip to content

Commit

Permalink
dns: simple make DDR request SOA.
Browse files Browse the repository at this point in the history
  • Loading branch information
pymumu committed Sep 9, 2023
1 parent 8befd9d commit 1ff7829
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/dns.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ typedef enum dns_type {
DNS_T_SRV = 33,
DNS_T_OPT = 41,
DNS_T_SSHFP = 44,
DNS_T_SVCB = 64,
DNS_T_HTTPS = 65,
DNS_T_SPF = 99,
DNS_T_AXFR = 252,
Expand Down
23 changes: 23 additions & 0 deletions src/dns_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -3961,6 +3961,20 @@ static int _dns_server_process_ptr(struct dns_request *request)
return 0;
}

static int _dns_server_process_DDR(struct dns_request *request)
{
return _dns_server_reply_SOA(DNS_RC_NOERROR, request);
}

static int _dns_server_process_srv(struct dns_request *request)
{
if (strncmp("_dns.resolver.arpa", request->domain, DNS_MAX_CNAME_LEN) == 0) {
return _dns_server_process_DDR(request);
}

return -1;
}

static void _dns_server_log_rule(const char *domain, enum domain_rule rule_type, unsigned char *rule_key,
int rule_key_len)
{
Expand Down Expand Up @@ -5147,6 +5161,15 @@ static int _dns_server_process_special_query(struct dns_request *request)
request->passthrough = 1;
}
break;
case DNS_T_SVCB:
ret = _dns_server_process_srv(request);
if (ret == 0) {
goto clean_exit;
} else {
/* pass to upstream server */
request->passthrough = 1;
}
break;
case DNS_T_A:
break;
case DNS_T_AAAA:
Expand Down

0 comments on commit 1ff7829

Please sign in to comment.