Skip to content

Commit

Permalink
* added additional handling of specific exceptions to propagate prope…
Browse files Browse the repository at this point in the history
…r return codes for specific DNS queries (#128)
  • Loading branch information
m0rcq committed Mar 17, 2021
1 parent 7c22d6d commit ee82e0a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/erldns_handler.erl
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,13 @@ safe_handle_packet_cache_miss(Message, AuthorityRecords, Host) ->
"~p)",
[?MODULE, resolve_error, Exception, Reason, Message, Stacktrace]),
erldns_events:notify({?MODULE, resolve_error, {Exception, Reason, Message, Stacktrace}}),
Message#dns_message{aa = false, rc = ?DNS_RCODE_SERVFAIL}
RCode = case Reason of
{error, rcode, ?DNS_RCODE_SERVFAIL} -> ?DNS_RCODE_SERVFAIL;
{error, rcode, ?DNS_RCODE_NXDOMAIN} -> ?DNS_RCODE_NXDOMAIN;
{error, rcode, ?DNS_RCODE_REFUSED} -> ?DNS_RCODE_REFUSED;
_ -> ?DNS_RCODE_SERVFAIL
end,
Message#dns_message{aa = false, rc = RCode}
end
end.

Expand Down

0 comments on commit ee82e0a

Please sign in to comment.