mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 14:35:26 +00:00
Return HTTP status code for small/malformed requests
This commit makes BIND return HTTP status codes for malformed or too small requests. DNS request processing code would ignore such requests. Such an approach works well for other DNS transport but does not make much sense for HTTP, not allowing it to complete the request/response sequence. Suppose execution has reached the point where DNS message handling code has been called. In that case, it means that the HTTP request has been successfully processed, and, thus, we are expected to respond to it either with a message containing some DNS payload or at least to return an error status code. This commit ensures that BIND behaves this way.
This commit is contained in:
@@ -1724,6 +1724,7 @@ ns__client_request(isc_nmhandle_t *handle, isc_result_t eresult,
|
||||
ns_client_log(client, DNS_LOGCATEGORY_SECURITY,
|
||||
NS_LOGMODULE_CLIENT, ISC_LOG_DEBUG(10),
|
||||
"dropped request: suspicious port");
|
||||
isc_nm_bad_request(handle);
|
||||
return;
|
||||
}
|
||||
#endif /* if NS_CLIENT_DROPPORT */
|
||||
@@ -1737,6 +1738,7 @@ ns__client_request(isc_nmhandle_t *handle, isc_result_t eresult,
|
||||
ns_client_log(client, DNS_LOGCATEGORY_SECURITY,
|
||||
NS_LOGMODULE_CLIENT, ISC_LOG_DEBUG(10),
|
||||
"dropped request: blackholed peer");
|
||||
isc_nm_bad_request(handle);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1750,6 +1752,7 @@ ns__client_request(isc_nmhandle_t *handle, isc_result_t eresult,
|
||||
* There isn't enough header to determine whether
|
||||
* this was a request or a response. Drop it.
|
||||
*/
|
||||
isc_nm_bad_request(handle);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1766,6 +1769,7 @@ ns__client_request(isc_nmhandle_t *handle, isc_result_t eresult,
|
||||
*/
|
||||
if ((flags & DNS_MESSAGEFLAG_QR) != 0) {
|
||||
CTRACE("unexpected response");
|
||||
isc_nm_bad_request(handle);
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user