diff options
author | Ronnie Sahlberg <sahlberg@ronnie> | 2007-04-28 01:06:26 +1000 |
---|---|---|
committer | Ronnie Sahlberg <sahlberg@ronnie> | 2007-04-28 01:06:26 +1000 |
commit | 916c55ec2ffcb28ff65a23cef21aa3333ce43dd6 (patch) | |
tree | 9e67582172c9f0f90fa324e9675c1253eeec9efe | |
parent | 5b4ebe134515e52735c2524d534f32b0690cd6c0 (diff) | |
download | samba-916c55ec2ffcb28ff65a23cef21aa3333ce43dd6.tar.gz samba-916c55ec2ffcb28ff65a23cef21aa3333ce43dd6.tar.xz samba-916c55ec2ffcb28ff65a23cef21aa3333ce43dd6.zip |
add a generation field to the pdu header.
this will allow a node to verify that a received pdu is sent from a node
in the same generation instance of a cluster.
(This used to be ctdb commit e32d3ca9a622237c4e2622de98825c0962760d48)
-rw-r--r-- | ctdb/common/ctdb_call.c | 6 | ||||
-rw-r--r-- | ctdb/common/ctdb_client.c | 6 | ||||
-rw-r--r-- | ctdb/common/ctdb_control.c | 2 | ||||
-rw-r--r-- | ctdb/common/ctdb_daemon.c | 5 | ||||
-rw-r--r-- | ctdb/common/ctdb_message.c | 1 | ||||
-rw-r--r-- | ctdb/direct/ctdbd_test.c | 4 | ||||
-rw-r--r-- | ctdb/include/ctdb_private.h | 1 |
7 files changed, 25 insertions, 0 deletions
diff --git a/ctdb/common/ctdb_call.c b/ctdb/common/ctdb_call.c index 86da20ea2e..3b2602c4d9 100644 --- a/ctdb/common/ctdb_call.c +++ b/ctdb/common/ctdb_call.c @@ -149,6 +149,7 @@ static void ctdb_send_error(struct ctdb_context *ctdb, r->hdr.length = len + msglen; r->hdr.ctdb_magic = CTDB_MAGIC; r->hdr.ctdb_version = CTDB_VERSION; + r->hdr.generation= ctdb->vnn_map->generation; r->hdr.operation = CTDB_REPLY_ERROR; r->hdr.destnode = hdr->srcnode; r->hdr.srcnode = ctdb->vnn; @@ -178,6 +179,7 @@ static void ctdb_call_send_redirect(struct ctdb_context *ctdb, r->hdr.length = sizeof(*r); r->hdr.ctdb_magic = CTDB_MAGIC; r->hdr.ctdb_version = CTDB_VERSION; + r->hdr.generation= ctdb->vnn_map->generation; r->hdr.operation = CTDB_REPLY_REDIRECT; r->hdr.destnode = c->hdr.srcnode; r->hdr.srcnode = ctdb->vnn; @@ -232,6 +234,7 @@ static void ctdb_send_dmaster_reply(struct ctdb_db_context *ctdb_db, r->hdr.length = len; r->hdr.ctdb_magic = CTDB_MAGIC; r->hdr.ctdb_version = CTDB_VERSION; + r->hdr.generation= ctdb->vnn_map->generation; r->hdr.operation = CTDB_REPLY_DMASTER; r->hdr.destnode = new_dmaster; r->hdr.srcnode = ctdb->vnn; @@ -274,6 +277,7 @@ static void ctdb_call_send_dmaster(struct ctdb_db_context *ctdb_db, r->hdr.length = len; r->hdr.ctdb_magic = CTDB_MAGIC; r->hdr.ctdb_version = CTDB_VERSION; + r->hdr.generation= ctdb->vnn_map->generation; r->hdr.operation = CTDB_REQ_DMASTER; r->hdr.destnode = lmaster; r->hdr.srcnode = ctdb->vnn; @@ -490,6 +494,7 @@ void ctdb_request_call(struct ctdb_context *ctdb, struct ctdb_req_header *hdr) r->hdr.length = len; r->hdr.ctdb_magic = CTDB_MAGIC; r->hdr.ctdb_version = CTDB_VERSION; + r->hdr.generation= ctdb->vnn_map->generation; r->hdr.operation = CTDB_REPLY_CALL; r->hdr.destnode = hdr->srcnode; r->hdr.srcnode = hdr->destnode; @@ -755,6 +760,7 @@ struct ctdb_call_state *ctdb_daemon_call_send_remote(struct ctdb_db_context *ctd state->c->hdr.length = len; state->c->hdr.ctdb_magic = CTDB_MAGIC; state->c->hdr.ctdb_version = CTDB_VERSION; + state->c->hdr.generation= ctdb_db->ctdb->vnn_map->generation; state->c->hdr.operation = CTDB_REQ_CALL; state->c->hdr.destnode = header->dmaster; /* diff --git a/ctdb/common/ctdb_client.c b/ctdb/common/ctdb_client.c index e9f1e8eb79..b0fcfd28a6 100644 --- a/ctdb/common/ctdb_client.c +++ b/ctdb/common/ctdb_client.c @@ -334,6 +334,7 @@ struct ctdb_client_call_state *ctdb_call_send(struct ctdb_db_context *ctdb_db, c->hdr.ctdb_magic = CTDB_MAGIC; c->hdr.ctdb_version = CTDB_VERSION; c->hdr.operation = CTDB_REQ_CALL; + c->hdr.generation= ctdb->vnn_map->generation; /* this limits us to 16k outstanding messages - not unreasonable */ c->hdr.reqid = ctdb_reqid_new(ctdb, state); c->flags = call->flags; @@ -394,6 +395,7 @@ int ctdb_set_message_handler(struct ctdb_context *ctdb, uint64_t srvid, c.hdr.length = sizeof(c); c.hdr.ctdb_magic = CTDB_MAGIC; c.hdr.ctdb_version = CTDB_VERSION; + c.hdr.generation = ctdb->vnn_map->generation; c.hdr.operation = CTDB_REQ_REGISTER; c.srvid = srvid; @@ -424,6 +426,7 @@ int ctdb_send_message(struct ctdb_context *ctdb, uint32_t vnn, r->hdr.length = len; r->hdr.ctdb_magic = CTDB_MAGIC; r->hdr.ctdb_version = CTDB_VERSION; + r->hdr.generation= ctdb->vnn_map->generation; r->hdr.operation = CTDB_REQ_MESSAGE; r->hdr.destnode = vnn; r->hdr.srcnode = ctdb->vnn; @@ -454,6 +457,7 @@ void ctdb_connect_wait(struct ctdb_context *ctdb) r.hdr.length = sizeof(r); r.hdr.ctdb_magic = CTDB_MAGIC; r.hdr.ctdb_version = CTDB_VERSION; + r.hdr.generation= ctdb->vnn_map->generation; r.hdr.operation = CTDB_REQ_CONNECT_WAIT; DEBUG(3,("ctdb_connect_wait: sending to ctdbd\n")); @@ -609,6 +613,7 @@ void ctdb_shutdown(struct ctdb_context *ctdb) r.hdr.length = len; r.hdr.ctdb_magic = CTDB_MAGIC; r.hdr.ctdb_version = CTDB_VERSION; + r.hdr.generation = ctdb->vnn_map->generation; r.hdr.operation = CTDB_REQ_SHUTDOWN; r.hdr.reqid = 0; @@ -692,6 +697,7 @@ int ctdb_control(struct ctdb_context *ctdb, uint32_t destnode, uint64_t srvid, c->hdr.length = len; c->hdr.ctdb_magic = CTDB_MAGIC; c->hdr.ctdb_version = CTDB_VERSION; + c->hdr.generation = ctdb->vnn_map->generation; c->hdr.operation = CTDB_REQ_CONTROL; c->hdr.reqid = state->reqid; c->hdr.destnode = destnode; diff --git a/ctdb/common/ctdb_control.c b/ctdb/common/ctdb_control.c index 423e4eedfc..4728c852c7 100644 --- a/ctdb/common/ctdb_control.c +++ b/ctdb/common/ctdb_control.c @@ -168,6 +168,7 @@ void ctdb_request_control(struct ctdb_context *ctdb, struct ctdb_req_header *hdr r->hdr.length = len; r->hdr.ctdb_magic = CTDB_MAGIC; r->hdr.ctdb_version = CTDB_VERSION; + r->hdr.generation = ctdb->vnn_map->generation; r->hdr.operation = CTDB_REPLY_CONTROL; r->hdr.destnode = hdr->srcnode; r->hdr.srcnode = ctdb->vnn; @@ -246,6 +247,7 @@ int ctdb_daemon_send_control(struct ctdb_context *ctdb, uint32_t destnode, c->hdr.length = len; c->hdr.ctdb_magic = CTDB_MAGIC; c->hdr.ctdb_version = CTDB_VERSION; + c->hdr.generation= ctdb->vnn_map->generation; c->hdr.operation = CTDB_REQ_CONTROL; c->hdr.destnode = destnode; c->hdr.srcnode = ctdb->vnn; diff --git a/ctdb/common/ctdb_daemon.c b/ctdb/common/ctdb_daemon.c index 49f3e24a1a..db1447c53b 100644 --- a/ctdb/common/ctdb_daemon.c +++ b/ctdb/common/ctdb_daemon.c @@ -123,6 +123,7 @@ static void daemon_message_handler(struct ctdb_context *ctdb, uint64_t srvid, r->hdr.length = len; r->hdr.ctdb_magic = CTDB_MAGIC; r->hdr.ctdb_version = CTDB_VERSION; + r->hdr.generation= ctdb->vnn_map->generation; r->hdr.operation = CTDB_REQ_MESSAGE; r->srvid = srvid; r->datalen = data.dsize; @@ -188,6 +189,7 @@ static void daemon_request_shutdown(struct ctdb_client *client, rf->hdr.length = len; rf->hdr.ctdb_magic = CTDB_MAGIC; rf->hdr.ctdb_version = CTDB_VERSION; + rf->hdr.generation= ctdb->vnn_map->generation; rf->hdr.operation = CTDB_REQ_FINISHED; rf->hdr.destnode = node; rf->hdr.srcnode = ctdb->vnn; @@ -228,6 +230,7 @@ static void daemon_request_connect_wait(struct ctdb_client *client, r.hdr.length = sizeof(r); r.hdr.ctdb_magic = CTDB_MAGIC; r.hdr.ctdb_version = CTDB_VERSION; + r.hdr.generation= client->ctdb->vnn_map->generation; r.hdr.operation = CTDB_REPLY_CONNECT_WAIT; r.vnn = ctdb_get_vnn(client->ctdb); r.num_connected = client->ctdb->num_connected; @@ -321,6 +324,7 @@ static void daemon_call_from_client_callback(struct ctdb_call_state *state) r->hdr.length = length; r->hdr.ctdb_magic = CTDB_MAGIC; r->hdr.ctdb_version = CTDB_VERSION; + r->hdr.generation = client->ctdb->vnn_map->generation; r->hdr.operation = CTDB_REPLY_CALL; r->hdr.reqid = dstate->reqid; r->datalen = dstate->call->reply_data.dsize; @@ -736,6 +740,7 @@ static void daemon_control_callback(struct ctdb_context *ctdb, r->hdr.length = len; r->hdr.ctdb_magic = CTDB_MAGIC; r->hdr.ctdb_version = CTDB_VERSION; + r->hdr.generation= ctdb->vnn_map->generation; r->hdr.operation = CTDB_REPLY_CONTROL; r->hdr.reqid = state->reqid; r->status = status; diff --git a/ctdb/common/ctdb_message.c b/ctdb/common/ctdb_message.c index 379af26e03..4f58259890 100644 --- a/ctdb/common/ctdb_message.c +++ b/ctdb/common/ctdb_message.c @@ -127,6 +127,7 @@ int ctdb_daemon_send_message(struct ctdb_context *ctdb, uint32_t vnn, r->hdr.length = len; r->hdr.ctdb_magic = CTDB_MAGIC; r->hdr.ctdb_version = CTDB_VERSION; + r->hdr.generation= ctdb->vnn_map->generation; r->hdr.operation = CTDB_REQ_MESSAGE; r->hdr.destnode = vnn; r->hdr.srcnode = ctdb->vnn; diff --git a/ctdb/direct/ctdbd_test.c b/ctdb/direct/ctdbd_test.c index 00b9f967df..1a3c2054b9 100644 --- a/ctdb/direct/ctdbd_test.c +++ b/ctdb/direct/ctdbd_test.c @@ -59,6 +59,7 @@ void register_pid_with_daemon(int fd, int pid) r.hdr.length = sizeof(r); r.hdr.ctdb_magic = CTDB_MAGIC; r.hdr.ctdb_version = CTDB_VERSION; + r.hdr.generation = 1; r.hdr.operation = CTDB_REQ_REGISTER; r.srvid = pid; @@ -80,6 +81,7 @@ int wait_for_cluster(int fd) req.hdr.length = sizeof(req); req.hdr.ctdb_magic = CTDB_MAGIC; req.hdr.ctdb_version = CTDB_VERSION; + req.hdr.generation = 1; req.hdr.operation = CTDB_REQ_CONNECT_WAIT; /* XXX must deal with partial writes here */ @@ -119,6 +121,7 @@ int send_a_message(int fd, int ourvnn, int vnn, int pid, TDB_DATA data) r.hdr.length = len; r.hdr.ctdb_magic = CTDB_MAGIC; r.hdr.ctdb_version = CTDB_VERSION; + r.hdr.generation = 1; r.hdr.operation = CTDB_REQ_MESSAGE; r.hdr.destnode = vnn; r.hdr.srcnode = ourvnn; @@ -201,6 +204,7 @@ void fetch_record(int fd, uint32_t db_id, TDB_DATA key) req->hdr.length = len; req->hdr.ctdb_magic = CTDB_MAGIC; req->hdr.ctdb_version = CTDB_VERSION; + req->hdr.generation = 1; req->hdr.operation = CTDB_REQ_CALL; req->hdr.reqid = 1; diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h index f3d0f72e12..3c249c25f5 100644 --- a/ctdb/include/ctdb_private.h +++ b/ctdb/include/ctdb_private.h @@ -312,6 +312,7 @@ struct ctdb_req_header { uint32_t length; uint32_t ctdb_magic; uint32_t ctdb_version; + uint32_t generation; uint32_t operation; uint32_t destnode; uint32_t srcnode; |