summaryrefslogtreecommitdiff
path: root/ctdb/protocol
Commit message (Collapse)AuthorAgeFilesLines
* ctdb: Initialize addr struct to zero before reparsing as IPV4Zhu Shangzhong2019-03-261-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> (cherry picked from commit 539b5ff32b32b7c75dfaaa119e41f5af6ff1e6fc)
* ctdb-common: Add fd argument to ctdb_connection_list_read()Amitay Isaacs2019-03-262-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> (cherry picked from commit 3bf753e830c20183ef4f3278880d3be362e53bef)
* ctdb-protocol: Avoid fgets in ctdb_connection_list_readAmitay Isaacs2019-03-261-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> (cherry picked from commit c9b42d27e6cf9e6ae36f44970f0a388edc737a7a)
* ctdb-protocol: Drop marshalling code for RECEIVE_RECORDS controlAmitay Isaacs2018-10-093-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> (cherry picked from commit 2f89bd96fb6c5e50cfc09604ceb6b96a94cb4f56)
* ctdb-protocol: Mark RECEIVE_RECORDS control obsoleteAmitay Isaacs2018-10-091-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> (cherry picked from commit 81dae71fa74bfd83a5701e4841b5a0a13cbe87a1)
* ctdb-common: Use sin6_len only if the structure supports itAmitay Isaacs2018-07-101-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> (cherry picked from commit 79992dbb73ac9749ac987cb6a88964fa600b4c35)
* ctdb-server: Rename CTDB_BROADCAST_VNNMAP -> CTDB_BROADCAST_ACTIVEMartin Schwenke2018-07-102-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> (cherry picked from commit 36938bfdd075a174daecb466085702adfe6a6c09)
* 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>
* ctdb-protocol: Fix CID 1417428Amitay Isaacs2017-09-051-1/+1
| | | | | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net> Autobuild-User(master): Martin Schwenke <martins@samba.org> Autobuild-Date(master): Tue Sep 5 15:16:06 CEST 2017 on sn-devel-144
* ctdb-protocol: Fix CID 1417430Amitay Isaacs2017-09-051-2/+2
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-protocol: Fix CID 1417433Amitay Isaacs2017-09-051-1/+1
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-protocol: Drop struct ctdb_event_headerAmitay Isaacs2017-09-013-60/+0
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-protocol: Replace ctdb_event_header with sock_packet_headerAmitay Isaacs2017-09-012-15/+19
| | | | | | | | | This removes the static declaration and adds prototype declarations of ctdb_event_header marshalling functions to avoid compiler warnings. These functions will be removed. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-protocol: Add a generic packet headerAmitay Isaacs2017-09-013-0/+103
| | | | | | | | This will avoid duplication when new daemons (and new client-server protocols) are created out of the main ctdb daemon. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-protocol: Fix marshalling of ctdb_event_replyAmitay Isaacs2017-08-301-0/+10
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-protocol: Fix marshalling for ctdb_event_requestAmitay Isaacs2017-08-301-0/+10
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-protocol: Fix marshalling for ctdb_event_headerAmitay Isaacs2017-08-301-10/+17
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-protocol: Fix marshalling for ctdb_event_reply_dataAmitay Isaacs2017-08-301-6/+15
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-protocol: Fix marshalling for ctdb_event_reply_script_listAmitay Isaacs2017-08-301-4/+8
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-protocol: Fix marshaling for ctdb_event_reply_statusAmitay Isaacs2017-08-301-4/+10
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-protocol: Fix marshalling for ctdb_event_request_dataAmitay Isaacs2017-08-301-6/+15
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-protocol: Fix marshalling for ctdb_event_request_script_disableAmitay Isaacs2017-08-301-4/+9
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-protocol: Fix marshalling for ctdb_event_request_script_enableAmitay Isaacs2017-08-301-4/+9
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-protocol: Fix marshalling for ctdb_event_request_statusAmitay Isaacs2017-08-301-4/+12
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-protocol: Fix marshalling for ctdb_event_request_runAmitay Isaacs2017-08-301-4/+11
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-protocol: Fix marshalling for ctdb_event_status_stateAmitay Isaacs2017-08-301-4/+8
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-protocol: Fix marshalling for ctdb_event_commandAmitay Isaacs2017-08-301-12/+19
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>