summaryrefslogtreecommitdiff
path: root/ctdb/protocol
AgeCommit message (Collapse)AuthorFilesLines
2025-05-29ctdb-protocol: Add CTDB server SRVID rangeMartin Schwenke1-0/+7
Normally, communication from other components to ctdbd is done via controls. However, there are contexts where receiving SRVID messages in ctdbd makes sense, such as replies to outgoing SRVID messages. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15858 Signed-off-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2024-10-07ctdb-protocol: Add function ctdb_sock_addr_from_sockaddr()Martin Schwenke2-0/+21
Signed-off-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: John Mulligan <jmulligan@redhat.com> Reviewed-by: Anoop C S <anoopcs@samba.org>
2024-07-23ctdb-protocol: Move ctdb_node_map_* to protocol_api.hMartin Schwenke2-5/+5
Signed-off-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: Anoop C S <anoopcs@samba.org>
2024-07-23ctdb-protocol: Move definition of CTDB_PORT to protocolMartin Schwenke1-0/+2
Users of CTDB_PORT will all pick up the new definition. Signed-off-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: Anoop C S <anoopcs@samba.org>
2024-04-24ctdb: Report errors from getline()Jo Sutton1-2/+10
Signed-off-by: Jo Sutton <josutton@catalyst.net.nz> Reviewed-by: Martin Schwenke <martin@meltin.net>
2024-04-24ctdb: Ensure ‘ret’ is always initializedJo Sutton1-1/+1
This avoids a compilation error: ../../ctdb/protocol/protocol_util.c: In function ‘ctdb_connection_list_read’: ../../ctdb/protocol/protocol_util.c:787:9: error: ‘ret’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 787 | return ret; | ^~~ Signed-off-by: Jo Sutton <josutton@catalyst.net.nz> Reviewed-by: Martin Schwenke <martin@meltin.net>
2024-04-16ctdb: Use stdio's getline() in ctdb_connection_list_read()Volker Lendecke1-11/+25
This is the only user of common/line.[ch], which can go next. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
2024-03-06ctdb: send a CTDB_SRVID_START_IPREALLOCATE message after ↵Vinit Agnihotri3-0/+14
CTDB_EVENT_START_IPREALLOCATE Event scripts run the "start_ipreallocate" hook in order to notice that some ip addresses in the cluster potentially changed. CTDB_SRVID_START_IPREALLOCATE gives C code a chance to get notified as well once the event scripts are finished. Signed-off-by: Vinit Agnihotri <vagnihotri@ddn.com> Reviewed-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: Volker Lendecke <vl@samba.org>
2024-03-06ctdb-protocol: Add new control CTDB_CONTROL_START_IPREALLOCATEVinit Agnihotri5-0/+30
Signed-off-by: Vinit Agnihotri <vagnihotri@ddn.com> Reviewed-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: Volker Lendecke <vl@samba.org>
2024-03-06ctdb-protocol: Add new event startipreallocateVinit Agnihotri2-0/+2
A new event is needed for NFS lock reclaim to ensure all nodes are in grace before any locks are released. This event must take place before releaseip. Signed-off-by: Vinit Agnihotri <vagnihotri@ddn.com> Reviewed-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: Volker Lendecke <vl@samba.org>
2024-02-19ctdb-protocol: Add missing push support for new controlsMartin Schwenke1-0/+8
CTDB_CONTROL_TCP_CLIENT_DISCONNECTED and CTDB_CONTROL_TCP_CLIENT_PASSED were added in commits c6602b686b4e50d93272667ef86d3904181fb1ab and 037e8e449deb136ad5ed5e4de05439411b545b6d. They were missing test support for the packet push/pull. While adding the testing (for completeness, before adding another new control) I noticed that the push functionality was absent. This adds that, along with the test support. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15580 Signed-off-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Mon Feb 19 10:21:48 UTC 2024 on atb-devel-224
2024-01-04ctdb: send a CTDB_SRVID_IPREALLOCATED message after CTDB_EVENT_IPREALLOCATEDStefan Metzmacher3-0/+14
Event scripts run the "ipreallocated" hook in order to notice that some ip addresses in the cluster potentially changed. CTDB_SRVID_IPREALLOCATED gives C code a chance to get notified as well once the event scripts are finished. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
2023-12-15ctdb: add/implement CTDB_CONTROL_TCP_CLIENT_PASSEDStefan Metzmacher3-0/+17
With multichannel a tcp connection is registered first with a temporary smbd process, that calls CTDB_CONTROL_TCP_CLIENT first and then passes the tcp connection to the longterm smbd that already handles all connections belonging to the specific client_guid. That smbd process calls CTDB_CONTROL_TCP_CLIENT again, but the 'tickle' information is already there. When the temporary smbd process exists/disconnects from ctdb or calls CTDB_CONTROL_TCP_CLIENT_DISCONNECTED, the 'tickle' information is removed, while the longterm smbd process still serves the tcp connection. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15523 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
2023-12-15ctdb: add/implement CTDB_CONTROL_TCP_CLIENT_DISCONNECTEDStefan Metzmacher3-0/+17
With multichannel a ctdb connection from smbd may hold multiple tcp connections, which can be disconnected before the smbd process terminates the whole ctdb connection, so we a way to remove undo 'CTDB_CONTROL_TCP_CLIENT' again. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15523 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
2023-12-15ctdb: add ctdb_connection_same() helperStefan Metzmacher2-0/+21
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
2022-07-22ctdb-protocol: Add separator argument to ctdb_connection_to_buf()Martin Schwenke2-9/+18
Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2022-02-23ctdb-protocol: CID 1499395: Uninitialized variables (UNINIT)Martin Schwenke1-1/+1
Issue is reported here: 853 case CTDB_CONTROL_DB_VACUUM: { 854 struct ctdb_db_vacuum db_vacuum; 855 >>> CID 1499395: Uninitialized variables (UNINIT) >>> Using uninitialized value "db_vacuum.full_vacuum_run" when calling "ctdb_db_vacuum_len". 856 CHECK_CONTROL_DATA_SIZE(ctdb_db_vacuum_len(&db_vacuum)); 857 return ctdb_control_db_vacuum(ctdb, c, indata, async_reply); 858 } The problem is that ctdb_bool_len() unnecessarily dereferences its argument, which in this case is &db_vacuum.full_vacuum_run. Not a security issue because the value copied by dereferencing is not used. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> Autobuild-User(master): Amitay Isaacs <amitay@samba.org> Autobuild-Date(master): Wed Feb 23 02:02:06 UTC 2022 on sn-devel-184
2022-01-17ctdb-protocol: Mark {GET,SET}_RECMASTER controls obsoleteMartin Schwenke1-2/+2
Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2022-01-17ctdb-protocol: Drop marshalling for {GET,SET}_RECMASTER controlsMartin Schwenke1-27/+0
Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2022-01-17ctdb-protocol: Drop protocol client functions for recmaster controlsMartin Schwenke2-54/+0
Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2022-01-17ctdb-protocol: Add CTDB_SRVID_LEADERMartin Schwenke2-1/+16
CTDB_SRVID_LEADER will be regularly broadcast to all connected nodes by the leader. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2022-01-13ctdb-protocol: Print IPv6 sockets with RFC5952 "[2001:db8::1]:80" notationMartin Schwenke1-4/+25
RFC5952 says the existing style is not recommended and the [] style should be employed. There are more optimised ways of adding the square brackets but they tend to be uglier. Parsing IPv6 sockets without [] is now tested indirectly by parsing examples in both styles and comparing the results. Signed-off-by: Martin Schwenke <martin@meltin.net> Signed-off-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Thu Jan 13 17:02:21 UTC 2022 on sn-devel-184
2022-01-13ctdb-protocol: Allow rfc5952 "[2001:db8::1]:80" ipv6 notationVolker Lendecke1-0/+13
Bug: https://bugzilla.samba.org/show_bug.cgi?id=14934 Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
2022-01-13ctdb-protocol: Save 50 bytes .text segmentVolker Lendecke1-1/+1
Having this as a small static .text is simpler than having to create this on the stack. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
2022-01-13ctdb-protocol: rindex->strrchrVolker Lendecke1-4/+4
According to "man rindex" on debian bullseye rindex() was deprecated in Posix.1-2001 and removed from Posix.1-2008. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
2021-09-09ctdb-recoverd: Mark CTDB_SRVID_SET_NODE_FLAGS obsoleteMartin Schwenke1-1/+1
CTDB_SRVID_SET_NODE_FLAGS is no longer sent so drop monitor_handler() and replace with srvid_not_implemented(). Mark the SRVID obsolete in its comment. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14784 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2021-09-09ctdb-protocol: Add marshalling for controls DISABLE_NODE/ENABLE_NODEMartin Schwenke4-0/+56
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14784 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2021-09-09ctdb-protocol: Add new controls to disable and enable nodesMartin Schwenke1-0/+2
These are CTDB_CONTROL_DISABLE_NODE and CTDB_CONTROL_ENABLE_NODE. For consistency these match CTDB_CONTROL_STOP_NODE and CTDB_CONTROL_CONTINUE_NODE. It would be possible to add a single control but it would need to take data. The aim is to finally fix races in flag handling. Previous fixes have improved the situation but they have only narrowed the race window. The problem is that the recovery daemon on the master node pushes flags to nodes the same way that disable and enable are implemented. So the following sequence is still racy: 1. Node A is disabled 2. Recovery master pulls flags from all nodes including A 3. Node A is enabled 4. Recovery master notices A is disabled and pushes a flag update to all nodes including node A 5. Node A is erroneously marked disabled Node A can not tell if the MODIFY_FLAGS control is from a "ctdb disable" command or a flag update from the recovery master. The solution is to use a different mechanism for disable/enable and for a node to ignore MODIFY_FLAGS controls for their own flags. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14784 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2020-09-11ctdb-daemon: Drop implementation of old-style database pull/push controlsMartin Schwenke1-2/+2
Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> Autobuild-User(master): Amitay Isaacs <amitay@samba.org> Autobuild-Date(master): Fri Sep 11 06:29:32 UTC 2020 on sn-devel-184
2020-09-11ctdb-protocol: Drop marshalling functions for old-style database pull/pushMartin Schwenke2-50/+0
Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2020-09-11ctdb-protocol: Drop client functions for old-style database pull/pushMartin Schwenke2-59/+0
Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2020-08-03lib: relicense smb_strtoul(l) under LGPLv3Ralph Boehme1-0/+1
Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Swen Schillig <swen@linux.ibm.com> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Mon Aug 3 22:21:04 UTC 2020 on sn-devel-184
2020-04-28ctdb-protocol: Add marshalling for control ECHO_DATAVolker Lendecke4-0/+61
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
2020-04-28ctdb-protocol: Add marshalling for struct ctdb_echo_dataVolker Lendecke2-0/+82
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
2020-04-28ctdb-protocol: Add new control CTDB_CONTROL_ECHO_DATAVolker Lendecke1-0/+8
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
2020-04-28ctdb: Fix duplicate ;;Volker Lendecke1-1/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
2020-03-23ctdb-protocol: Add control flag CTDB_CTRL_FLAG_ATTACH_RECOVERYMartin Schwenke1-0/+1
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14294 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-10-24ctdb-protocol: Add marshalling for control DB_VACUUMMartin Schwenke4-0/+54
Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-10-24ctdb-protocol: Add marshalling for struct ctdb_db_vacuumMartin Schwenke2-0/+73
Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-10-24ctdb-protocol: Add new control CTDB_CONTROL_DB_VACUUMMartin Schwenke1-0/+8
Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-10-24ctdb-protocol: Add marshalling for new control VACUUM_FETCHAmitay Isaacs4-0/+51
Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
2019-10-24ctdb-protocol: Add new control VACUUM_FETCHAmitay Isaacs1-0/+1
Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
2019-10-24ctdb-protocol: Drop code related to obsolete controlsAmitay Isaacs2-69/+0
Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
2019-10-04ctdb-protocol: Initialise request->rdata.opcode where missingMartin Schwenke1-0/+4
Otherwise it is uninitialised, so... ==22889== Conditional jump or move depends on uninitialised value(s) ==22889== at 0x12257B: ctdb_req_control_data_len (protocol_control.c:39) ==22889== by 0x1228E9: ctdb_req_control_len (protocol_control.c:1786) ==22889== by 0x12A51C: ctdb_client_control_send (client_control.c:101) ==22889== by 0x138BE1: ctdb_tunnel_setup_send (client_tunnel.c:100) ==22889== by 0x10EE4F: tunnel_test_send (tunnel_test.c:135) ==22889== by 0x10EE4F: main (tunnel_test.c:463) and similar. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-07-05ctdb-protocol: Avoid signed/unsigned comparison by castingMartin Schwenke2-10/+10
Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-07-05ctdb-protocol: Variable for return value of strlcpy() should be size_tMartin Schwenke1-1/+1
This avoids an unnecessary signed/unsigned comparison issue. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-07-05ctdb-protocol: Fix signed/unsigned comparison by declaring as unsignedMartin Schwenke1-1/+2
Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-07-05ctdb-protocol: Do not ignore return value of ctdb_g_lock_pull()Martin Schwenke1-1/+1
clang reports: ctdb/protocol/protocol_types.c:5191:3: warning: Value stored to 'ret' is never read Found by csbuild. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-06-30ctdb: Update all consumers of strtoul_err(), strtoull_err() to new APISwen Schillig1-6/+4
Signed-off-by: Swen Schillig <swen@linux.ibm.com> Reviewed-by: Ralph Boehme <slow@samba.org> Reviewed-by: Christof Schmitt <cs@samba.org>
2019-06-04ctdb:protocol_util: remove 'const' from allocated stringsStefan Metzmacher2-11/+12
The caller should be able to call TALLOC_FREE() on the returned strings. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>