summaryrefslogtreecommitdiff
path: root/usr.sbin/nsd/ipc.c
diff options
context:
space:
mode:
authorStuart Henderson <sthen@cvs.openbsd.org>2012-11-23 20:29:21 +0000
committerStuart Henderson <sthen@cvs.openbsd.org>2012-11-23 20:29:21 +0000
commit4f2dfd8624d5483f761809d6816f2da1e9aaf2d8 (patch)
treeb28978f05001b38bfb88f0b75e32c8582fefa248 /usr.sbin/nsd/ipc.c
parent066a7097b41034621876001b2737fdf4d9b17be4 (diff)
update to NSD 3.2.14, requested by/ok brad@
Diffstat (limited to 'usr.sbin/nsd/ipc.c')
-rw-r--r--usr.sbin/nsd/ipc.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/usr.sbin/nsd/ipc.c b/usr.sbin/nsd/ipc.c
index 157e4185c2e..b2911e39f6b 100644
--- a/usr.sbin/nsd/ipc.c
+++ b/usr.sbin/nsd/ipc.c
@@ -396,10 +396,10 @@ parent_handle_child_command(netio_type *ATTR_UNUSED(netio),
/* read rest later */
return;
}
- /* read the acl number */
+ /* read the acl numbers */
got_acl = data->got_bytes - sizeof(data->total_bytes) - data->total_bytes;
if((len = read(handler->fd, (char*)&data->acl_num+got_acl,
- sizeof(data->acl_num)-got_acl)) == -1 ) {
+ sizeof(data->acl_num)+sizeof(data->acl_xfr)-got_acl)) == -1 ) {
log_msg(LOG_ERR, "handle_child_command: read: %s",
strerror(errno));
return;
@@ -411,7 +411,7 @@ parent_handle_child_command(netio_type *ATTR_UNUSED(netio),
}
got_acl += len;
data->got_bytes += len;
- if(got_acl >= (int)sizeof(data->acl_num)) {
+ if(got_acl >= (int)(sizeof(data->acl_num)+sizeof(data->acl_xfr))) {
uint16_t len = htons(data->total_bytes);
DEBUG(DEBUG_IPC,2, (LOG_INFO,
"main fwd passed packet write %d", (int)data->got_bytes));
@@ -426,7 +426,9 @@ parent_handle_child_command(netio_type *ATTR_UNUSED(netio),
!write_socket(*data->xfrd_sock, buffer_begin(data->packet),
data->total_bytes) ||
!write_socket(*data->xfrd_sock, &data->acl_num,
- sizeof(data->acl_num))) {
+ sizeof(data->acl_num)) ||
+ !write_socket(*data->xfrd_sock, &data->acl_xfr,
+ sizeof(data->acl_xfr))) {
log_msg(LOG_ERR, "error in ipc fwd main2xfrd: %s",
strerror(errno));
}
@@ -595,7 +597,7 @@ xfrd_send_quit_req(xfrd_state_t* xfrd)
xfrd->ipc_handler.event_types &= (~NETIO_EVENT_WRITE);
xfrd->sending_zone_state = 0;
DEBUG(DEBUG_IPC,1, (LOG_INFO, "xfrd: ipc send ackreload(quit)"));
- if(write_socket(xfrd->ipc_handler.fd, &cmd, sizeof(cmd)) == -1) {
+ if(!write_socket(xfrd->ipc_handler.fd, &cmd, sizeof(cmd))) {
log_msg(LOG_ERR, "xfrd: error writing ack to main: %s",
strerror(errno));
}
@@ -723,6 +725,7 @@ xfrd_handle_ipc_read(netio_handler_type *handler, xfrd_state_t* xfrd)
if(xfrd->ipc_conn->is_reading==2) {
buffer_type* tmp = xfrd->ipc_pass;
uint32_t acl_num;
+ int32_t acl_xfr;
/* read acl_num */
int ret = conn_read(xfrd->ipc_conn);
if(ret == -1) {
@@ -737,7 +740,8 @@ xfrd_handle_ipc_read(netio_handler_type *handler, xfrd_state_t* xfrd)
xfrd->ipc_conn->packet = tmp;
xfrd->ipc_conn->is_reading = 0;
acl_num = buffer_read_u32(xfrd->ipc_pass);
- xfrd_handle_passed_packet(xfrd->ipc_conn->packet, acl_num);
+ acl_xfr = (int32_t)buffer_read_u32(xfrd->ipc_pass);
+ xfrd_handle_passed_packet(xfrd->ipc_conn->packet, acl_num, acl_xfr);
return;
}
if(xfrd->ipc_conn->is_reading) {
@@ -761,7 +765,7 @@ xfrd_handle_ipc_read(netio_handler_type *handler, xfrd_state_t* xfrd)
xfrd->ipc_pass = xfrd->ipc_conn->packet;
xfrd->ipc_conn->packet = tmp;
xfrd->ipc_conn->total_bytes = sizeof(xfrd->ipc_conn->msglen);
- xfrd->ipc_conn->msglen = sizeof(uint32_t);
+ xfrd->ipc_conn->msglen = 2*sizeof(uint32_t);
buffer_clear(xfrd->ipc_conn->packet);
buffer_set_limit(xfrd->ipc_conn->packet, xfrd->ipc_conn->msglen);
}