summaryrefslogtreecommitdiff
path: root/ctdb
Commit message (Collapse)AuthorAgeFilesLines
* ctdb: Fix the build on FreeBSDVolker Lendecke2023-01-181-0/+1
| | | | | | | "basename" is define in libgen.h included from system/dir.h Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* ctdb: Fix a use-after-free in run_procVolker Lendecke2022-10-061-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If you happen to talloc_free(run_ctx) before all the tevent_req's hanging off it, you run into the following: ==495196== Invalid read of size 8 ==495196== at 0x10D757: run_proc_state_destructor (run_proc.c:413) ==495196== by 0x488F736: _tc_free_internal (talloc.c:1158) ==495196== by 0x488FBDD: _talloc_free_internal (talloc.c:1248) ==495196== by 0x4890F41: _talloc_free (talloc.c:1792) ==495196== by 0x48538B1: tevent_req_received (tevent_req.c:293) ==495196== by 0x4853429: tevent_req_destructor (tevent_req.c:129) ==495196== by 0x488F736: _tc_free_internal (talloc.c:1158) ==495196== by 0x4890AF6: _tc_free_children_internal (talloc.c:1669) ==495196== by 0x488F967: _tc_free_internal (talloc.c:1184) ==495196== by 0x488FBDD: _talloc_free_internal (talloc.c:1248) ==495196== by 0x4890F41: _talloc_free (talloc.c:1792) ==495196== by 0x10DE62: main (run_proc_test.c:86) ==495196== Address 0x55b77f8 is 152 bytes inside a block of size 160 free'd ==495196== at 0x48399AB: free (vg_replace_malloc.c:538) ==495196== by 0x488FB25: _tc_free_internal (talloc.c:1222) ==495196== by 0x488FBDD: _talloc_free_internal (talloc.c:1248) ==495196== by 0x4890F41: _talloc_free (talloc.c:1792) ==495196== by 0x10D315: run_proc_context_destructor (run_proc.c:329) ==495196== by 0x488F736: _tc_free_internal (talloc.c:1158) ==495196== by 0x488FBDD: _talloc_free_internal (talloc.c:1248) ==495196== by 0x4890F41: _talloc_free (talloc.c:1792) ==495196== by 0x10DE62: main (run_proc_test.c:86) ==495196== Block was alloc'd at ==495196== at 0x483877F: malloc (vg_replace_malloc.c:307) ==495196== by 0x488EAD9: __talloc_with_prefix (talloc.c:783) ==495196== by 0x488EC73: __talloc (talloc.c:825) ==495196== by 0x488F0FC: _talloc_named_const (talloc.c:982) ==495196== by 0x48925B1: _talloc_zero (talloc.c:2421) ==495196== by 0x10C8F2: proc_new (run_proc.c:61) ==495196== by 0x10D4C9: run_proc_send (run_proc.c:381) ==495196== by 0x10DDF6: main (run_proc_test.c:79) This happens because run_proc_context_destructor() directly does a talloc_free() on the struct proc_context's and not the enclosing tevent_req's. run_proc_kill() makes sure that we don't follow proc->req, but it forgets the "state->proc", which is free()'ed, but later dereferenced in run_proc_state_destructor(). This is an attempt at a quick fix, I believe we should convert run_proc_context->plist into an array of tevent_req's, so that we can properly TALLOC_FREE() according to the "natural" hierarchy and not just pull an arbitrary thread out of that heap. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Thu Oct 6 15:10:20 UTC 2022 on sn-devel-184
* ctdb-scripts: Add debugging variable CTDB_KILLTCP_DEBUGLEVELMartin Schwenke2022-09-201-1/+7
| | | | | | | | | | | | | | To debug ctdb_killtcp failures, add CTDB_KILLTCP_DEBUGLEVEL=DEBUG to script.options. 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): Tue Sep 20 11:42:16 UTC 2022 on sn-devel-184
* ctdb-common: Support IB in pcap-based captureMartin Schwenke2022-09-201-0/+2
| | | | | | | | | | | | Add simple support for IPoIB via DLT_LINUX_SLL and DLT_LINUX_SLL2. This seems to work, even when an IB interface is specified. If this is later found to be insufficient, support for DLT_IPOIB can be implemented. See https://www.tcpdump.org/linktypes.html for a starting point. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-common: Support "any" interface for pcap-based captureMartin Schwenke2022-09-201-1/+49
| | | | | | | | | | | | | | | | | | | This uses Linux cooked capture link-layer headers. See: https://www.tcpdump.org/linktypes/LINKTYPE_LINUX_SLL.html https://www.tcpdump.org/linktypes/LINKTYPE_LINUX_SLL2.html The header type needs to be checked to ensure the protocol type (i.e. ether type, for the protocols we might be interested in) is meaningful. The size of the header needs to be known so it can be skipped, allowing the IP header to be found and parsed. It would be possible to define support for DLT_LINUX_SLL2 if it is missing. However, if a platform is missing support in the header file then it is almost certainly missing in the run-time library too. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-common: Add packet type detection to pcap-based captureMartin Schwenke2022-09-201-18/+49
| | | | | | | | | | | | | | | | | | | | | | | | | The current code will almost certainly generate ENOMSG for non-ethernet packets, even for ethernet packets when the "any" interface is used. pcap_datalink(3PCAP) says: Do NOT assume that the packets for a given capture or ``savefile`` will have any given link-layer header type, such as DLT_EN10MB for Ethernet. For example, the "any" device on Linux will have a link-layer header type of DLT_LINUX_SLL or DLT_LINUX_SLL2 even if all devices on the sys‐ tem at the time the "any" device is opened have some other data link type, such as DLT_EN10MB for Ethernet. So, pcap_datalink() must be used. Detect pcap packet types that are supported (currently only ethernet) in the open code. There is no use continuing if the read code can't parse packets. The pattern of using switch statements supports future addition of other packet types. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Improve/add debugMartin Schwenke2022-09-201-6/+7
| | | | | | | | In particular, knowing the reason fetching the packet fails can help with debugging unsupported protocols in the pcap code. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-common: Improve/add debugMartin Schwenke2022-09-201-2/+6
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-common: Use pcap_get_selectable_fd()Martin Schwenke2022-09-201-1/+1
| | | | | | | | This is preferred because it will fail for devices that do not support epoll_wait() and similar. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-common: Stop a pcap-related crash on errorMartin Schwenke2022-09-201-2/+5
| | | | | | | errbuf can't be NULL. Might as well use it. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-common: Fix a warning in the pcap codeMartin Schwenke2022-09-201-2/+2
| | | | | | | | | | | [173/416] Compiling ctdb/common/system_socket.c ../../common/system_socket.c: In function ‘ctdb_sys_read_tcp_packet’: ../../common/system_socket.c:1016:15: error: cast discards ‘const’ qualifier from pointer target type [-Werror=cast-qual] 1016 | eth = (struct ether_header *)buffer; | ^ Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-common: Do not use raw socket when ENABLE_PCAP is definedMartin Schwenke2022-09-201-3/+3
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-common: Move a misplaced commentMartin Schwenke2022-09-201-7/+6
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-build: Add --enable-pcap configure optionMartin Schwenke2022-09-201-1/+6
| | | | | | | | | | | | | | | This forces the use pcap for packet capture on Linux. It appears that using a raw socket for capture does not work with infiniband - pcap support for that to come. Don't (yet?) change the default capture method to pcap. On some platforms (e.g. my personal Intel NUC, running Debian testing), pcap is much less reliable than the raw socket. However, pcap seems fine on most other platforms. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-build: Use pcap-config when availableMartin Schwenke2022-09-201-0/+6
| | | | | | | | | The build currently fails on AIX, which can't find the pcap headers because they're installed in a non-standard place. However, there is a pcap-config script available. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Reformat remaining test stubs with "shfmt -w -p -i 0 -fn"Martin Schwenke2022-09-1626-573/+647
| | | | | | | | 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 16 04:35:09 UTC 2022 on sn-devel-184
* ctdb-tests: Include eventscript stub commands in shellcheck testMartin Schwenke2022-09-161-0/+4
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Avoid shellcheck warnings in remaining test stubsMartin Schwenke2022-09-1610-44/+64
| | | | | | | A small amount of effort... Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-scripts: Simplify determination of real interfaceMartin Schwenke2022-09-161-17/+7
| | | | | | | This can now be made trivial. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Implement "ip -brief link show" in ip stubMartin Schwenke2022-09-161-4/+30
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Avoid ShellCheck warningsMartin Schwenke2022-09-161-38/+42
| | | | | | | | Although this is a test stub, it is complicated enough to encourage ShellCheck cleanliness. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Reformat script with "shfmt -w -p -i 0 -fn"Martin Schwenke2022-09-161-524/+648
| | | | | | | As per current Samba convention. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-scripts: Drop assumption that there are VLANs with no '@'Martin Schwenke2022-09-161-6/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | VLAN configuration on Linux often uses a convention of naming a VLAN on <iface> with VLAN ID <tag> as <iface>.<tag>. To be able to monitor the underlying interface, the original 10.interface code naively simply stripped off the '.' and everything after (i.e. ".*", as a glob pattern). Some users do not use the above convention. A VLAN can be named without including the underlying interface, but still with a tag (e.g. vlan<tag> - the word "vlan" following by the tag) or, more generally, perhaps without a tag (e.g. <vlan> - an arbitrary name). The ip(8) command lists a VLAN as <vlan>@<iface>. The underlying interface can be found by stripping everything up to and including an '@' (i.e. "*@"). Commit bc71251433ce618c95c674d7cbe75b01a94adad9 added support for stripping "*@". However, on suspicion, it kept support for the case where there is no '@', falling back to stripping ".*". If ip(8) ever did this then it was a long time ago - it has been printing a format including '@' since at least 2004. Stripping ".*" interferes with interesting administrative decisions, like having '.' in interface names. So, drop the fallback to stripping ".*" because it appears to be unnecessary and can cause inconvenience. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* Fix spelling mistakes.Michael Tokarev2022-09-121-1/+1
| | | | | | | | | Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Mon Sep 12 02:29:32 UTC 2022 on sn-devel-184
* ctdb-tests: Avoid shellcheck warningsMartin Schwenke2022-08-251-3/+5
| | | | | | | | | | | | | | | Mostly SC2086: Double quote to prevent globbing and word splitting. Use ctdb_onnode() where it simplifies code. No behaviour changes intended. 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 Aug 25 16:15:45 UTC 2022 on sn-devel-184
* ctdb-tests: Simplify IP address checkingMartin Schwenke2022-08-251-19/+10
| | | | | | | | | | | Use a new function and wait_until() to simplify. get_test_ip_mask_and_iface() not needed here because select_test_node_and_ips() sets $test_ip, and neither $mask nor $iface is used. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Fix typosMartin Schwenke2022-08-251-2/+2
| | | | | | | | | | | | | | | | These lines are just wrong: try_command_on_node -v $test_node "ip addr show to ${test_node}" if -n "$out"; then The 2nd variable referenced should be $test_ip. The 2nd line causes "-n: command not found" because it is missing [] test command brackets. Both typos would probably make the test pass unconditionally. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Reformat script using shfmt -w -p -i 0 -fnMartin Schwenke2022-08-251-12/+12
| | | | | | | Whitespace changes only. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-common: CID 1507498: Control flow issues (DEADCODE)Martin Schwenke2022-08-013-1/+41
| | | | | | | | | | | | | | Fix typo in error checking. While here adjust the bottom of the range, making errno 0 invalid. Add corresponding test cases using an alternative syntax for errno packets (#nnn[;] - trailing ';' is optional). 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): Mon Aug 1 09:19:55 UTC 2022 on sn-devel-184
* ctdb-tests: Add tests for cluster mutex I/O timeoutMartin Schwenke2022-07-282-0/+128
| | | | | | | | | | | | Block the locker helper child by taking a lock on the 2nd byte of the lock file. This will cause a ping timeout if the process is blocked for long enough. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> Autobuild-User(master): Martin Schwenke <martins@samba.org> Autobuild-Date(master): Thu Jul 28 11:10:54 UTC 2022 on sn-devel-184
* ctdb-tests: Terminate event loop if lock is no longer heldMartin Schwenke2022-07-281-1/+1
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-mutex: Test the lock by locking a 2nd byte rangeMartin Schwenke2022-07-281-0/+17
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-mutex: open() and fstat() when testing lock fileMartin Schwenke2022-07-282-6/+26
| | | | | | | This makes a file descriptor available for other I/O. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-mutex: Factor out function fcntl_lock_fd()Martin Schwenke2022-07-281-12/+25
| | | | | | | | | | | Allows blocking mode and start offset to be specified. Always locks a 1-byte range. Make the lock structure static to avoid initialising the whole structure each time. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-mutex: Handle pings from lock checking child to parentMartin Schwenke2022-07-281-13/+45
| | | | | | | | The ping timeout is specified by passing an extra argument to the mutex helper, representing the ping timeout in seconds. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-mutex: Do inode checks in a child processMartin Schwenke2022-07-282-30/+288
| | | | | | | | | | | In future this will allow extra I/O tests and a timeout in the parent to (hopefully) release the lock if the child gets wedged. For simplicity, use tmon only to detect when either parent or child goes away. Plumbing a timeout for pings from child to parent will be done later. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-mutex: Rename wait_for_lost to lock_io_checkMartin Schwenke2022-07-281-18/+21
| | | | | | | This will be generalised to do more I/O-based checks. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-mutex: Rename recheck_time to recheck_intervalMartin Schwenke2022-07-283-19/+19
| | | | | | | There will be more timeouts so clarify the intent of this one. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-mutex: Consistently use progname in error messagesMartin Schwenke2022-07-281-13/+15
| | | | | | | | To avoid error messages having ridiculously long paths, set progname to basename(argv[0]). Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Add tests for trivial FD monitoringMartin Schwenke2022-07-285-0/+1102
| | | | | | | | | | tmon_ping_test covers complex 2-way interaction between processes using tmon_ping_send(), including via a socketpair(). tmon_test covers the more general functionality of tmon_send() but uses a simpler 1-way harness with wide coverage. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-common: Add trivial FD monitoring abstractionMartin Schwenke2022-07-283-2/+831
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-build: Link in backtrace support for ctdb_util_testsMartin Schwenke2022-07-281-2/+10
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-build: Separate test backtrace support into separate subsystemMartin Schwenke2022-07-281-3/+8
| | | | | | | | | | | | | | A convention when testing members of ctdb-util is to include the .c file so that static functions can potentially be tested. This means that such tests can't be linked against ctdb-util or duplicate symbols will be encountered. ctdb-tests-common depends on ctdb-client, which depends in turn on ctdb-util, so this can't be used to pull in backtrace support. Instead, make ctdb-tests-backtrace its own subsystem. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-build: Sort sources in ctdb-util and ctdb_unit_testsMartin Schwenke2022-07-281-19/+30
| | | | | | | | Also, rename ctdb_unit_tests to ctdb_util_tests. The sorting makes it clear that only items from ctdb-util are tested here. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-daemon: Fix printing of tickle ACKsMartin Schwenke2022-07-281-1/+1
| | | | | | | | | | | | | | | | | | Commit f5a20377347aba18700d010d4201775fc83a0b1b arguably got this back-to-front: 2022-07-27T09:50:01.985857+10:00 testn1 ctdbd[17820]: ../../ctdb/server/ctdb_takeover.c:514 sending TAKE_IP for '10.0.1.173' 2022-07-27T09:50:01.990601+10:00 testn1 ctdbd[17820]: Send TCP tickle ACK: 10.0.1.77:33004 -> 10.0.1.173:2049 2022-07-27T09:50:01.991323+10:00 testn1 ctdb-takeover[19758]: TAKEOVER_IP 10.0.1.173 succeeded on node 0 Unfortunately there is an inconsistency somewhere in the connection tracking code used for tickle ACKs, making this less than obvious. 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 Jul 28 09:02:08 UTC 2022 on sn-devel-184
* ctdb-build: Add missing dependency on tallocMartin Schwenke2022-07-222-1/+2
| | | | | | | | | | | The include isn't strictly necessary, since it is included via common/reqid.c anyway. However, it is a useful hint. 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 Jul 22 17:01:00 UTC 2022 on sn-devel-184
* ctdb-tests: Work around unreadable file test failure when rootMartin Schwenke2022-07-221-1/+7
| | | | | | | | root can read files for which the mode prohibits reading, so this test case fails when run as root. Work around this when running as root. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-scripts: Use "git config" as last resort to parse nfs.confMartin Schwenke2022-07-221-2/+7
| | | | | | | | | | Some versions of nfs-utils (e.g. recent CentOS 7) use /etc/nfs.conf but do not include the nfsconf utility to extract values from the file. However, git has an excellent conf file parser, so use it as a last resort. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-scripts: Avoid ShellCheck warning SC2295Martin Schwenke2022-07-224-7/+9
| | | | | | | | | | | | | | | | | | | For example: In /home/martins/samba/samba/ctdb/tools/onnode line 304: [ "$nodes" != "${nodes%[ ${nl}]*}" ] && verbose=true ^---^ SC2295 (info): Expansions inside ${..} need to be quoted separately, otherwise they match as patterns. Did you mean: [ "$nodes" != "${nodes%[ "${nl}"]*}" ] && verbose=true For more information: https://www.shellcheck.net/wiki/SC2295 -- Expansions inside ${..} need to b... Who knew? Thanks ShellCheck! Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-common: Use POSIX if_nameindex() to check interface existenceMartin Schwenke2022-07-223-38/+33
| | | | | | | | | | | | | | | | | | This works as an unprivileged user, so avoids unnecessary errors when running in test mode (and not as root): 2022-02-18T12:21:12.436491+11:00 node.0 ctdbd[6958]: ctdb_sys_check_iface_exists: Failed to open raw socket 2022-02-18T12:21:12.436534+11:00 node.0 ctdbd[6958]: ctdb_sys_check_iface_exists: Failed to open raw socket 2022-02-18T12:21:12.436557+11:00 node.0 ctdbd[6958]: ctdb_sys_check_iface_exists: Failed to open raw socket 2022-02-18T12:21:12.436577+11:00 node.0 ctdbd[6958]: ctdb_sys_check_iface_exists: Failed to open raw socket The corresponding porting test would now become pointless because it would just confirm that "fake" does not exist. Attempt to make it useful by using a less likely name than "fake" and attempting to detect the loopback interface. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>