mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-01 23:25:38 +00:00
3655. [cleanup] Simplify TCP message processing when requesting a
zone transfer. [RT #34825]
This commit is contained in:
3
CHANGES
3
CHANGES
@@ -1,3 +1,6 @@
|
|||||||
|
3655. [cleanup] Simplify TCP message processing when requesting a
|
||||||
|
zone transfer. [RT #34825]
|
||||||
|
|
||||||
3654. [bug] Address race condition with manual notify requests.
|
3654. [bug] Address race condition with manual notify requests.
|
||||||
[RT #34806]
|
[RT #34806]
|
||||||
|
|
||||||
|
@@ -14,13 +14,14 @@
|
|||||||
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
# PERFORMANCE OF THIS SOFTWARE.
|
# PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
TOP=$( (cd ../../.. && pwd) )
|
SYSTEMTESTTOP=..
|
||||||
|
. ../conf.sh
|
||||||
|
|
||||||
addr=127.127.0.0
|
addr=127.127.0.0
|
||||||
ttl=300
|
ttl=300
|
||||||
named=${TOP}/bin/named/named
|
named=${NAMED}
|
||||||
keygen=${TOP}/bin/dnssec/dnssec-keygen
|
keygen=${KEYGEN}
|
||||||
dsfromkey=${TOP}/bin/dnssec/dnssec-dsfromkey
|
dsfromkey=${DSFROMKEY}
|
||||||
|
|
||||||
nextaddr() {
|
nextaddr() {
|
||||||
OLDIF="$IFS"
|
OLDIF="$IFS"
|
||||||
|
@@ -221,7 +221,6 @@ static isc_result_t xfrin_start(dns_xfrin_ctx_t *xfr);
|
|||||||
static void xfrin_connect_done(isc_task_t *task, isc_event_t *event);
|
static void xfrin_connect_done(isc_task_t *task, isc_event_t *event);
|
||||||
static isc_result_t xfrin_send_request(dns_xfrin_ctx_t *xfr);
|
static isc_result_t xfrin_send_request(dns_xfrin_ctx_t *xfr);
|
||||||
static void xfrin_send_done(isc_task_t *task, isc_event_t *event);
|
static void xfrin_send_done(isc_task_t *task, isc_event_t *event);
|
||||||
static void xfrin_sendlen_done(isc_task_t *task, isc_event_t *event);
|
|
||||||
static void xfrin_recv_done(isc_task_t *task, isc_event_t *event);
|
static void xfrin_recv_done(isc_task_t *task, isc_event_t *event);
|
||||||
static void xfrin_timeout(isc_task_t *task, isc_event_t *event);
|
static void xfrin_timeout(isc_task_t *task, isc_event_t *event);
|
||||||
|
|
||||||
@@ -881,8 +880,11 @@ xfrin_create(isc_mem_t *mctx,
|
|||||||
xfr->sourceaddr = *sourceaddr;
|
xfr->sourceaddr = *sourceaddr;
|
||||||
isc_sockaddr_setport(&xfr->sourceaddr, 0);
|
isc_sockaddr_setport(&xfr->sourceaddr, 0);
|
||||||
|
|
||||||
isc_buffer_init(&xfr->qbuffer, xfr->qbuffer_data,
|
/*
|
||||||
sizeof(xfr->qbuffer_data));
|
* Reserve 2 bytes for TCP length at the begining of the buffer.
|
||||||
|
*/
|
||||||
|
isc_buffer_init(&xfr->qbuffer, &xfr->qbuffer_data[2],
|
||||||
|
sizeof(xfr->qbuffer_data) - 2);
|
||||||
|
|
||||||
xfr->magic = XFRIN_MAGIC;
|
xfr->magic = XFRIN_MAGIC;
|
||||||
*xfrp = xfr;
|
*xfrp = xfr;
|
||||||
@@ -1065,10 +1067,8 @@ static isc_result_t
|
|||||||
xfrin_send_request(dns_xfrin_ctx_t *xfr) {
|
xfrin_send_request(dns_xfrin_ctx_t *xfr) {
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
isc_region_t region;
|
isc_region_t region;
|
||||||
isc_region_t lregion;
|
|
||||||
dns_rdataset_t *qrdataset = NULL;
|
dns_rdataset_t *qrdataset = NULL;
|
||||||
dns_message_t *msg = NULL;
|
dns_message_t *msg = NULL;
|
||||||
unsigned char length[2];
|
|
||||||
dns_difftuple_t *soatuple = NULL;
|
dns_difftuple_t *soatuple = NULL;
|
||||||
dns_name_t *qname = NULL;
|
dns_name_t *qname = NULL;
|
||||||
dns_dbversion_t *ver = NULL;
|
dns_dbversion_t *ver = NULL;
|
||||||
@@ -1137,12 +1137,16 @@ xfrin_send_request(dns_xfrin_ctx_t *xfr) {
|
|||||||
isc_buffer_usedregion(&xfr->qbuffer, ®ion);
|
isc_buffer_usedregion(&xfr->qbuffer, ®ion);
|
||||||
INSIST(region.length <= 65535);
|
INSIST(region.length <= 65535);
|
||||||
|
|
||||||
length[0] = region.length >> 8;
|
/*
|
||||||
length[1] = region.length & 0xFF;
|
* Record message length and adjust region to include TCP
|
||||||
lregion.base = length;
|
* length field.
|
||||||
lregion.length = 2;
|
*/
|
||||||
CHECK(isc_socket_send(xfr->socket, &lregion, xfr->task,
|
xfr->qbuffer_data[0] = (region.length >> 8) & 0xff;
|
||||||
xfrin_sendlen_done, xfr));
|
xfr->qbuffer_data[1] = region.length & 0xff;
|
||||||
|
region.base -= 2;
|
||||||
|
region.length += 2;
|
||||||
|
CHECK(isc_socket_send(xfr->socket, ®ion, xfr->task,
|
||||||
|
xfrin_send_done, xfr));
|
||||||
xfr->sends++;
|
xfr->sends++;
|
||||||
|
|
||||||
failure:
|
failure:
|
||||||
@@ -1159,42 +1163,6 @@ xfrin_send_request(dns_xfrin_ctx_t *xfr) {
|
|||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX there should be library support for sending DNS TCP messages */
|
|
||||||
|
|
||||||
static void
|
|
||||||
xfrin_sendlen_done(isc_task_t *task, isc_event_t *event) {
|
|
||||||
isc_socketevent_t *sev = (isc_socketevent_t *) event;
|
|
||||||
dns_xfrin_ctx_t *xfr = (dns_xfrin_ctx_t *) event->ev_arg;
|
|
||||||
isc_result_t evresult = sev->result;
|
|
||||||
isc_result_t result;
|
|
||||||
isc_region_t region;
|
|
||||||
|
|
||||||
REQUIRE(VALID_XFRIN(xfr));
|
|
||||||
|
|
||||||
UNUSED(task);
|
|
||||||
|
|
||||||
INSIST(event->ev_type == ISC_SOCKEVENT_SENDDONE);
|
|
||||||
isc_event_free(&event);
|
|
||||||
|
|
||||||
xfr->sends--;
|
|
||||||
if (xfr->shuttingdown) {
|
|
||||||
maybe_free(xfr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
xfrin_log(xfr, ISC_LOG_DEBUG(3), "sent request length prefix");
|
|
||||||
CHECK(evresult);
|
|
||||||
|
|
||||||
isc_buffer_usedregion(&xfr->qbuffer, ®ion);
|
|
||||||
CHECK(isc_socket_send(xfr->socket, ®ion, xfr->task,
|
|
||||||
xfrin_send_done, xfr));
|
|
||||||
xfr->sends++;
|
|
||||||
failure:
|
|
||||||
if (result != ISC_R_SUCCESS)
|
|
||||||
xfrin_fail(xfr, result, "failed sending request length prefix");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
xfrin_send_done(isc_task_t *task, isc_event_t *event) {
|
xfrin_send_done(isc_task_t *task, isc_event_t *event) {
|
||||||
isc_socketevent_t *sev = (isc_socketevent_t *) event;
|
isc_socketevent_t *sev = (isc_socketevent_t *) event;
|
||||||
|
Reference in New Issue
Block a user