Commit e5e8a126 authored by Michael Graff's avatar Michael Graff
Browse files

make tcp queries (where the output is slightly offset from the start

of the buffer, for length of tcp packet) work again.
parent 51c0bc9e
......@@ -108,8 +108,8 @@ dispatch(isc_mem_t *mctx, isc_region_t *rxr, unsigned int reslen)
/*
* Set up the temporary output buffer.
*/
isc_buffer_init(&target, t, sizeof(t), ISC_BUFFERTYPE_BINARY);
isc_buffer_add(&target, reslen);
isc_buffer_init(&target, t + reslen, sizeof(t) - reslen,
ISC_BUFFERTYPE_BINARY);
/*
* Set up the input buffer from the contents of the region passed
......@@ -124,22 +124,21 @@ dispatch(isc_mem_t *mctx, isc_region_t *rxr, unsigned int reslen)
return (result);
/*
* Copy the reply out
* Copy the reply out, adjusting for reslen
*/
isc_buffer_used(&target, &txr);
txr.length += reslen;
txr.base = isc_mem_get(mctx, txr.length);
txr.base = isc_mem_get(mctx, txr.length + reslen);
if (txr.base == NULL)
return (DNS_R_NOMEMORY);
memcpy(txr.base + reslen, t + reslen, txr.length - reslen);
memcpy(txr.base + reslen, t + reslen, txr.length);
rxr->base = txr.base;
rxr->length = txr.length;
rxr->length = txr.length + reslen;
printf("Base == %p, length == %u\n", txr.base, txr.length);
fflush(stdout);
dump_packet(txr.base + reslen, txr.length - reslen);
dump_packet(rxr->base + reslen, rxr->length - reslen);
isc_mem_stats(mctx, stdout);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment