Skip to content
This repository has been archived by the owner on Feb 21, 2024. It is now read-only.

Commit

Permalink
ctdb-protocol: Fix marshalling for GET_DB_SEQNUM control request
Browse files Browse the repository at this point in the history
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12259

Even though database id is 32-bit, it's sent on wire as 64-bits.
The database id is the first 32-bits on the wire.  This needs fixing
eventually, but for now keep the same wire format.

Signed-off-by: Amitay Isaacs <[email protected]>
Reviewed-by: Martin Schwenke <[email protected]>
  • Loading branch information
amitay authored and Martin Schwenke committed Sep 14, 2016
1 parent b0dadbe commit bdff625
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions ctdb/protocol/protocol_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ struct ctdb_reply_control_wire {
static size_t ctdb_req_control_data_len(struct ctdb_req_control_data *cd)
{
size_t len = 0;
uint64_t u64;

if (cd == NULL) {
return 0;
Expand Down Expand Up @@ -335,8 +334,7 @@ static size_t ctdb_req_control_data_len(struct ctdb_req_control_data *cd)
break;

case CTDB_CONTROL_GET_DB_SEQNUM:
u64 = cd->data.db_id;
len = ctdb_uint64_len(u64);
len = ctdb_uint64_len((uint64_t)cd->data.db_id);
break;

case CTDB_CONTROL_DB_SET_HEALTHY:
Expand Down Expand Up @@ -452,8 +450,6 @@ static size_t ctdb_req_control_data_len(struct ctdb_req_control_data *cd)
static void ctdb_req_control_data_push(struct ctdb_req_control_data *cd,
uint8_t *buf)
{
uint64_t u64;

switch (cd->opcode) {
case CTDB_CONTROL_PROCESS_EXISTS:
ctdb_pid_push(cd->data.pid, buf);
Expand Down Expand Up @@ -635,8 +631,7 @@ static void ctdb_req_control_data_push(struct ctdb_req_control_data *cd,
break;

case CTDB_CONTROL_GET_DB_SEQNUM:
u64 = cd->data.db_id;
ctdb_uint64_push(u64, buf);
ctdb_uint32_push(cd->data.db_id, buf);
break;

case CTDB_CONTROL_DB_SET_HEALTHY:
Expand Down Expand Up @@ -735,7 +730,6 @@ static int ctdb_req_control_data_pull(uint8_t *buf, size_t buflen,
struct ctdb_req_control_data *cd)
{
int ret = 0;
uint64_t u64 = 0;

cd->opcode = opcode;

Expand Down Expand Up @@ -964,8 +958,8 @@ static int ctdb_req_control_data_pull(uint8_t *buf, size_t buflen,
break;

case CTDB_CONTROL_GET_DB_SEQNUM:
ret = ctdb_uint64_pull(buf, buflen, mem_ctx, &u64);
cd->data.db_id = (uint32_t)u64;
ret = ctdb_uint32_pull(buf, buflen, mem_ctx,
&cd->data.db_id);
break;

case CTDB_CONTROL_DB_SET_HEALTHY:
Expand Down

0 comments on commit bdff625

Please sign in to comment.