summaryrefslogtreecommitdiff
path: root/ctdb/protocol
Commit message (Collapse)AuthorAgeFilesLines
* ctdb-protocol: Add marshalling for control DB_VACUUMMartin Schwenke2019-10-244-0/+54
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-protocol: Add marshalling for struct ctdb_db_vacuumMartin Schwenke2019-10-242-0/+73
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-protocol: Add new control CTDB_CONTROL_DB_VACUUMMartin Schwenke2019-10-241-0/+8
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-protocol: Add marshalling for new control VACUUM_FETCHAmitay Isaacs2019-10-244-0/+51
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-protocol: Add new control VACUUM_FETCHAmitay Isaacs2019-10-241-0/+1
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-protocol: Drop code related to obsolete controlsAmitay Isaacs2019-10-242-69/+0
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-protocol: Initialise request->rdata.opcode where missingMartin Schwenke2019-10-041-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>
* ctdb-protocol: Avoid signed/unsigned comparison by castingMartin Schwenke2019-07-052-10/+10
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-protocol: Variable for return value of strlcpy() should be size_tMartin Schwenke2019-07-051-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>
* ctdb-protocol: Fix signed/unsigned comparison by declaring as unsignedMartin Schwenke2019-07-051-1/+2
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-protocol: Do not ignore return value of ctdb_g_lock_pull()Martin Schwenke2019-07-051-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>
* ctdb: Update all consumers of strtoul_err(), strtoull_err() to new APISwen Schillig2019-06-301-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>
* ctdb:protocol_util: remove 'const' from allocated stringsStefan Metzmacher2019-06-042-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>
* ctdb-protocol: Update error check for new string conversion wrapperSwen Schillig2019-04-111-2/+2
| | | | | | | | | | | The new string conversion wrappers detect and flag errors which occured during the string to integer conversion. Those modifications required an update of the callees error checks. Signed-off-by: Swen Schillig <swen@linux.ibm.com> Reviewed-by: Ralph Boehme <slow@samba.org> Reviewed-by: Christof Schmitt <cs@samba.org>
* ctdb: Initialize addr struct to zero before reparsing as IPV4Zhu Shangzhong2019-03-151-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Failed to kill the tcp connection that using IPv4-mapped IPv6 address (e.g. ctdb_killtcp eth0 ::ffff:192.168.200.44:2049 ::ffff:192.168.200.45:863). When the ctdb_killtcp is used to kill the tcp connection, the IPs and ports in the connection will be parsed to conn.client and conn.server (call stack: main->ctdb_sock_addr_from_string->ip_from_string). In the ip_from_string, as we are using IPv4-mapped IPv6 addresses, the ipv6_from_string will be used to parse ip to addr.ip6 first. The next step the ipv4_from_string will be used to reparse ip to addr.ip. As a result, the data that dump from conn.server is "2 0 8 1 192 168 200 44 0 0 0 0 0 0 0 0 0 0 255 255 192 168 200 44 0 0 0 0", the data from conn.client is "2 0 3 95 192 168 200 45 0 0 0 0 0 0 0 0 0 0 255 255 192 168 200 45 0 0 0 0". The connection will be add to conn_list by ctdb_connection_list_add. Then the reset_connections_send uses conn_list as parameter to start to reset connections in the conn_list. In the reset_connections_send, the database "connections" will be created. The connections from conn_list will be written to the database(call db_hash_add), and use the data that dump from conn_client and conn_server as key. In the reset_connections_capture_tcp_handler, the ctdb_sys_read_tcp_packet will receive data on the raw socket. And extract the IPs and ports from the tcp packet. when extracting IP and port, the tcp4_extract OR tcp6_extract will be used. Then we got the new conn.client and conn.server. the data that dump from the conn.server is "2 0 8 1 192 168 200 44 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0", the data from conn.client is "2 0 3 95 192 168 200 45 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0". Finally, we use the data as key to check if this connection is one being reset(call db_hash_delete). The db_hash_delete will return ENOENT. Because the two key that being used by db_hash_delete and db_hash_add are different. So, the TCP RST will be NOT sent for the connection forever. We should initialize addr struct to zero before reparsing as IPV4 in the ip_from_string. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13839 Signed-off-by: Zhu Shangzhong <zhu.shangzhong@zte.com.cn> Reviewed-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@samba.org>
* ctdb-protocol: Use wrapper for string to integer conversionSwen Schillig2019-03-011-5/+6
| | | | | | | | | | | | In order to detect an value overflow error during the string to integer conversion with strtoul/strtoull, the errno variable must be set to zero before the execution and checked after the conversion is performed. This is achieved by using the wrapper function strtoul_err and strtoull_err. Signed-off-by: Swen Schillig <swen@linux.ibm.com> Reviewed-by: Ralph Böhme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* ctdb-protocol: Drop marshalling code for RECEIVE_RECORDS controlAmitay Isaacs2018-10-083-61/+0
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=13641 Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-protocol: Mark RECEIVE_RECORDS control obsoleteAmitay Isaacs2018-10-081-1/+1
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=13641 Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-common: Add fd argument to ctdb_connection_list_read()Amitay Isaacs2018-07-282-3/+7
| | | | | | | | | This makes testing easier. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520 Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-protocol: Avoid fgets in ctdb_connection_list_readAmitay Isaacs2018-07-281-37/+49
| | | | | | | | | | C library buffering API can behave in unexpected fashion if underlying fd for stdin, stdout or stderr is closed and re-opened. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520 Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-protocol: Add function ctdb_sock_addr_mask_from_string()Martin Schwenke2018-07-272-0/+44
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-protocol: Fix compilation issue with strncpy()Martin Schwenke2018-07-271-3/+1
| | | | | | | | | | | | | | | | | | | When configured with --picky-developer and using -O3 with gcc 8.1: ../protocol/protocol_util.c: In function ‘ctdb_sock_addr_from_string’: ../protocol/protocol_util.c:282:2: error: ‘strncpy’ specified bound depends on the length of the source argument [-Werror=stringop-overflow=] strncpy(s, str, len+1); ^~~~~~~~~~~~~~~~~~~~~~ ../protocol/protocol_util.c:277:8: note: length computed here len = strlen(str); ^~~~~~~~~~~ Use strlcpy() instead and check the result. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13545 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-protocol: Remove protocol for old event daemonAmitay Isaacs2018-07-053-1015/+0
| | | | | | | | This breaks the build. The new eventd protocol cannot be introduced without removing the old eventd protocol. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-protocol: Separate protocol-basic subsystemAmitay Isaacs2018-07-053-66/+88
| | | | | | | | This includes marshalling code for basic data types. This will be used by other daemons. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-server: Rename CTDB_BROADCAST_VNNMAP -> CTDB_BROADCAST_ACTIVEMartin Schwenke2018-07-022-3/+3
| | | | | | | | | | | | | | | | | | | | | This broadcast is misnamed. Both places where this type of broadcast is used expect the broadcast to go to all active nodes. Make the corresponding change to the semantics in the daemon by sending to all active nodes. There is a mismatch between the ideas of VNN map and active nodes. A node that is not in the VNN map but is active can still host database records. These were the same until the LMASTER capability was introduced and then the logic was not updated. The only place where the VNN map is relevant is when finding the location master of a record in the migration code. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13499 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-common: Use sin6_len only if the structure supports itAmitay Isaacs2018-07-021-1/+1
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=13493 Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-protocol: Fix typo in type of return variableMartin Schwenke2017-10-161-1/+1
| | | | | | | This causes failures to be folded down to 1, which is incorrect. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Volker Lendecke <vl@samba.org>
* ctdb-protocol: Add tunnel id prefix for testingAmitay Isaacs2017-10-102-1/+7
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-protocol: Add protocol marshalling for CTDB_REQ_TUNNELAmitay Isaacs2017-10-103-0/+175
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-protocol: Add protocol marshalling for tunnel controlsAmitay Isaacs2017-10-104-0/+64
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-protocol: Add req_tunnel counts to ctdb statisticsAmitay Isaacs2017-10-102-0/+24
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-protocol: Add controls to register/deregister tunnelsAmitay Isaacs2017-10-101-0/+2
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-protocol: Add REQ_TUNNEL packet typeAmitay Isaacs2017-10-101-0/+11
| | | | | | | This allows to tunnel new protocols using ctdb transport. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-protocol: Add marshalling for control CHECK_PID_SRVIDAmitay Isaacs2017-09-214-0/+56
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=13042 Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-protocol: Add marshalling for struct ctdb_pid_srvidAmitay Isaacs2017-09-212-0/+59
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=13042 Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-protocol: Add new control CTDB_CONTROL_CHECK_PID_SRVIDAmitay Isaacs2017-09-211-0/+7
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=13042 Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-protocol: Add ctdb_connection_list utilitiesMartin Schwenke2017-09-192-0/+153
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-protocol: Add marshalling for ctdb_connection_listMartin Schwenke2017-09-192-0/+84
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-protocol: Add new data structure ctdb_connection_listMartin Schwenke2017-09-191-0/+5
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-protocol: Add ctdb_connection utilitiesMartin Schwenke2017-09-192-0/+103
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-protocol: Factor out static function ctdb_sock_addr_cmp_family()Martin Schwenke2017-09-191-4/+15
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-protocol: Add ctdb_sock_addr_from_string()Martin Schwenke2017-09-192-0/+128
| | | | | | | | | This and the supporting functions duplicate functionality (parse_ip() and parse_ip_port()) from common/system_util.c. The old functions will be removed at a later time. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-protocol: Optionally print port for address printing functionsMartin Schwenke2017-09-192-7/+22
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-protocol: Add utility function ctdb_sock_addr_to_buf()Martin Schwenke2017-09-192-12/+40
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-protocol: Add ctdb_sock_addr_port() and sock_addr_set_port()Martin Schwenke2017-09-192-0/+30
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-protocol: Add server and client aliases in ctdb_connectionMartin Schwenke2017-09-191-2/+8
| | | | | | | | The current code is ambiguous in its use of src and dst. This allows new code to use server and client for clarity. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-build: Split protocol-util as a separate subsystemMartin Schwenke2017-09-193-21/+44
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-protocol: Drop marshalling for monitor controlsMartin Schwenke2017-09-142-68/+0
| | | | | | | | 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): Thu Sep 14 18:42:28 CEST 2017 on sn-devel-144
* ctdb-daemon: Drop monitoring modeMartin Schwenke2017-09-141-3/+0
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-daemon: Mark monitoring controls obsoleteMartin Schwenke2017-09-141-3/+3
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>