Commit Graph

117 Commits

Author SHA1 Message Date
Jan Friesse
9bba026bcd knet: Use block_unlisted_ips
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2019-05-29 16:30:18 +02:00
Fabio M. Di Nitto
5c9a2b1c06 knet: allow corosync to use knet access lists
currently knet acl are only available on master
but they might be backported
to stable1 as they don´t break onwire protocol.

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2019-05-29 16:29:35 +02:00
Jan Friesse
d05636b738 totemconfig: Remove support for 3des
Triple DES is considered as a "weak cipher" since 2016 so there is
really no need to support it in the corosync. Thanks to bug in
Corosync/Knet/NSS which caused 3des to not work at all,
no matter what library was used, we can just remove support for 3des
without braking the compatibility.

Also fix coroparse so:
- totem.crypto_type is removed (this is 1.x construct which was not used
even in 2.x)
- Add checking of totem.crypto_model.
- Enumarate possible values for crypto_model, crypto_cipher and
crypto_hash error messages

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2019-04-11 15:15:38 +02:00
Jan Friesse
7c825173de coroparse: Fix compiler warning
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2019-02-26 13:28:40 +01:00
Ferenc Wágner
ba24bef8bd More natural error messages
Signed-off-by: Ferenc Wágner <wferi@debian.org>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2019-01-03 09:48:51 +01:00
Jan Friesse
a84ade701c totemconfig: Enhance totem.ip_version
Originally totem.ip_version was used to force ip version used by totem.
With Knet this variable didn't make too much sense so it was not used.

Sadly rely only on DNS resolver order doesn't always work (RFC is quite
complicated, but if IPv6 is not configured then IPv4 is preferred), what
we tried to solve by forcing IPv6 and only if that fails, use IPv4.

Sadly this collides with nss_myhostname which is able to return every
local address and today system usually have at least one autogenerated
link-local IPv6 address so it is able to "overwrite" /etc/hosts.

Solution is to enhance totem.ip_version and use it also for Knet.
totem.ip_version is now just a flag for resolver and can have four
states: ipv4 (only IPv4 is used), ipv6 (only IPv6 is used), ipv4-6 (ask
IPv4 first and if it fails ask for IPv6) and ipv6-4 (ask IPv6 first and
if it fails ask for IPv4). Default for Knet and UDPU transports is
ipv6-4, for UDP it's ipv4, because autogenerated mcast addr doesn't play
too well with ipv6-4.

So everywhere where nss_myhostname becomes problem, it's just possible
to set totem.ip_version to ipv4-6.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2018-12-14 10:56:06 +01:00
Jan Friesse
42aded40cb coroparse: Remove unused cs_err initialization
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2018-11-29 17:50:01 +01:00
Jan Friesse
2f9aaefbb7 main: Replace COROSYNC_MAIN_CONFIG_FILE
COROSYNC_MAIN_CONFIG_FILE environment variable was quite well hidden
and it was never used by init script. It also makes quite hard to debug
possible problems.

Replace it by -c option.

Also patch makes use of configuration file path as a base for uidgid.d
directory, so it's no longer needed to keep uidgid.d in sysconfdir.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2018-11-15 17:30:14 +01:00
Jan Friesse
cd4d5fd38e main: Move sched paramaters to config file
The reason for this change is, that number of corosync CLI options
kind of exploded and scheduler based one are really beter to be kept in
config file.

Nice side-effect of this move is better "integration" with systemd,
because currently used EnvironmentFile should be really used for
environment and not that much for passing extra options to CLI.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2018-11-15 17:30:03 +01:00
Jan Friesse
e3989c2b56 coroparse: Fix newly introduced warning
Small fix for a problem introduced by "coroparse: Use key_name for error
message" patch.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2018-09-07 16:53:08 +02:00
Jan Friesse
0ac659608d coroparse: Use key_name for error message
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2018-09-06 13:02:03 +02:00
Jan Friesse
f6262e5755 coroparse: Add file name and line to error message
It's just much easier to find out what is happening when message like

parser error: /etc/corosync/corosync.conf:39: Unexpected closing brace

is logged instead of

parser error: Unexpected closing brace

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2018-09-06 13:01:56 +02:00
Jan Friesse
80701845ab coroparse: Be more strict in what is parsed
Corosync parser is not very clever, but it is able to detect more errors
without too much code.

1. Check if section name is not empty (just '{' character)
2. Check if there is no extra characters after opening bracket '{'
3. Check if there is no extra characters after or before closing bracket
   '}'
4. Check if line is opening section, closing section or key/value

So following examples are reported as error:

totem {
    version: 2
}}}}}}}}}}

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2018-09-06 13:01:35 +02:00
Jan Friesse
7a4725f9da coroparse: Fix remove_whitespace end condition
When remove_whitespace function parameter is single character string
with whitespaces (like a:) then colon is not removed. Reason is end
condition end != start, which is valid for empty string, but invalid in
case described above. Solution is to check if *end is '\0'.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2018-09-06 13:01:20 +02:00
Jan Friesse
ffb759cd7d coroparse: Check icmap_set results
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2018-09-06 13:01:12 +02:00
Jan Friesse
20bd68b3fb coroparse: Return error if config line is too long
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2018-09-06 13:01:01 +02:00
Chris Walker
3f7d2cf6aa Add token_warning configuration option
Token_warning is used to present information about
when the token was last received.

Signed-off-by: Chris Walker <cwalker@cray.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2018-08-14 10:34:49 +02:00
Christine Caulfield
fc8580bdbf totem: Use nodeid ONLY in srp_addr
This shrinks the srp_addr (and consequently every packet sent by
corosync) so that instead of containing loads of IP addresses to
identify a node, it just sends the nodeid.

This then allows us to make ring0 optional and replaceable when running
knet.

It also means that we need some other way of identifying the local
node in corosync.conf, so the nodelist.node.name entry is now mandatory
and is mapped to the local host using the same algorithm as used in
cman.

This code needs LOTS of testing as it touches a huge amount of totemsrp
and totemconfig.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2018-03-01 14:18:51 +01:00
Jan Friesse
f05d1c9293 coroparse: Do not convert empty uid, gid to 0
When uid (or gid) value was empty string it was incorrectly converted to
0. Solution is to check input string emptines.

Thanks Bin Liu <bliu@suse.com> for reporting the bug.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Bin Liu <bliu@suse.com>
2017-11-06 09:37:54 +01:00
Christine Caulfield
16f616b65d knet: Add support for knet compression
Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2017-10-23 17:30:25 +02:00
Bin Liu
c83e6c7ed9 coroparse: Use readdir instead of readdir_r
readdir_r is deprecated in glibc 2.24 in favor of readdir (which became
thread safe). Also because corosync never calls read_uidgid_files_into_icmap
in muliple threads, no problem should appears even with libc where
readdir is thread-safe.

Signed-off-by: Bin Liu <bliu@suse.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2017-04-20 08:53:54 +02:00
Christine Caulfield
c0f1d576d6 knet: Fix MTU sizes & allow transport config in corosync.conf
Corosync layers don't need to know the knet MTU size - this way
corosync fragments buffers only when they get larger than the
KNET buffer size (64K) and knet fragments below that based on
the actual MTU and transport considerations.

It is also now possible to configure knet to use UDP or SCTP
transports in corosync.conf. This is currently done per-link
so if you have more than 1 link you need several interface{}
stanzas inside totem{} to make it use other than the default
of UDP. if it's useful I might add the option of a global
default.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
2017-02-13 16:54:30 +00:00
Christine Caulfield
7cec6a131d knet: Allow configuration of more params
knet_pmtud_interval &
knet_pong_count

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
2016-11-15 09:32:09 +00:00
Jan Friesse
1f90c31ba7 list: Replace for_each by safe version where need
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2016-10-27 14:56:52 +02:00
Michael Jones
b4c06e52f3 list: Replace uses of list.h with qblist.h
Signed-off-by: Michael Jones <jonesmz@jonesmz.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2016-10-27 14:56:52 +02:00
Christine Caulfield
268cde6ee4 totem: Add Kronosnet transport.
This is a big update that removes RRP & MRP from the codebase
and makes knet the default transport for corosync. UDP & UDPU
are still (currently) supported but are deprecated. Also crypto
and mutiple interfaces are only supported over knet.

To compile this codebase you will need to install libknet from
https://github.com/fabbione/kronosnet

The corosync.conf(5) man page has been updated with info on the new
options. Older config files should still work but many options
have changed because of the knet implementation so configs should
be checked carefully. In particular any cluster using using RRP
over UDP or UDPU will not start as RRP is no longer present. If you
need multiple interface support then you should be using the knet transport.

Knet brings many benefits to the corosync codebase, it provides support
for more interfaces than RRP (up to 8), will be more reliable in the event
of network outages and allows dynamic reconfiguration of interfaces.
It also fixes the ifup/ifdown and 127.0.0.1 binding problems that have
plagued corosync/openais from day 1

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
2016-10-11 10:09:42 +01:00
HideoYamauchi
f1ffe31ce5 coropase: Set a poll_period value for wd monitor
Signed-off-by: HideoYamauchi <renayama19661014@ybb.ne.jp>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2016-10-06 15:48:38 +02:00
Jan Friesse
f837f95dfe Config: Flag config uidgid entries
Uidgid entries parsed from configuration files now has prefix
(uidgid.config.) so they are distinguishable from dynamically added
entries. Entries added from config file are pruned on reload if no
longer exists in config file (dynamic one stays unaffected). Also whole
uidgid.config. prefix is made read only.

This make PCMK work again after configuration reload is called.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2016-08-04 16:13:48 +02:00
yuusuke
39cd6b3d1d parser: WD Read type correctly from corosync.conf
Signed-off-by: yuusuke <yusk.iida@gmail.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2016-05-27 10:36:24 +02:00
Christine Caulfield
aab55a004b parser: Make config file parser more hierarchy
pass 'state' down the stack so that the state of the
hierarchy doesn't get lost when there are unexpected items
in the config hierarchy.

Don't bother setting 'state' on SECTION_END as there's no point
now we're going back up the stack.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2016-04-22 13:01:04 +02:00
Jan Friesse
17488909d4 votequorum: Make qdev timeout in sync configurable
Configuration option quorum.device.sync_timeout is available for setting
qdevice poll timeout for synchronization phase. Default value is 30
sec.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2014-08-05 17:22:52 +02:00
Christine Caulfield
3b8365e806 config: Fix typos
Fix several places where 'then' is used instead of 'than' in error
messages and a comment.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2014-07-24 10:27:45 +01:00
Jan Friesse
4e9716ed30 coroparse: More strict numbers parsing
Previous safe_atoi didn't check range of input values so if for example
user used -1 s token timeout, it was converted to UINT32_MAX without
letting user know.

Another safe_atoi problem was using strtol. This works pretty well on
64-bit systems, where long integer is usually 64-bits long, sadly on
32-bit systems, it is usually 32-bit long. And because strtol returns
signed integer, it was not possible to enter 32-bit value with highest
bit set.

Solution is to use strtoll which is guaranteed to be at least 64-bits
long and check value range.

Also error message now contains also information about expected value
range.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2014-06-12 14:49:00 +02:00
Jan Friesse
58176d6779 Add token_coefficient option
Token coefficient is used only when nodelist is specified and contains
at least 3 nodes. If so, real token timeout is then computed as
token + (number_of_nodes - 2) * token_coefficient. This allows cluster
to scale without manually changing token timeout every time new
node is added. This value can be set to 0 resulting in effective
removal of this feature.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2014-03-25 15:29:17 +01:00
Christine Caulfield
ff6a43edb3 votequorum: Add persistent expected_votes tracking.
This patch adds the option to store expected_votes to
persistent storage. This is needed to allow_downscale
to operate properly.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
2014-01-07 15:30:11 +00:00
Christine Caulfield
bc47c583bd Reload: Make coroparse use a designated icmap hash table
Pass an icmap hashtable into coroparse so we can load it into
a temporary one during reload

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2013-09-12 16:09:06 +01:00
Jan Friesse
675da75759 coroparse: Ensure that config items fits into cmap
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
2013-06-18 14:35:05 +02:00
Jan Friesse
ce9c69da03 Properly break MAIN_CP_CB_DATA_STATE_QDEVICE state
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
2013-06-13 10:53:55 +02:00
Jan Friesse
966f461b69 Properly check result of stat func in coroparse
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
2013-06-13 10:53:55 +02:00
Jan Friesse
86b074dc1a Support for numerical uid/gid
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
2013-04-02 09:32:10 +02:00
Andrei Belov
005e7fd3b9 Improved POSIX-compliant handling of getpwnam_r() and getgrnam_r().
Signed-off-by: Andrei Belov <defanator@gmail.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2013-03-28 16:32:53 +01:00
Jeremy Fitzhardinge
52f88d04ea Handle ERANGE from getpwnam_r / getgrnam_r
These functions return ERANGE if the supplied buffer is too small to
fit a line.  Try doubling the buffer a few times until it works.
2013-03-07 16:59:51 -08:00
Jan Friesse
66172a501a Handle unexpected closing brace in config file
If configuration file contains closing brace before opening brace
at top level, configuration parsing is stopped and file is not
completely parsed. Solution is to detect extra closing brace and display
error.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
2013-01-31 16:11:22 +01:00
Jan Friesse
663489d277 Handle colon in configuration file
If colon was entered as part of value on end of value, it is deleted.
This makes impossible to enter (legal) IPv6 address ending with :: (like
fed0::).

Also when line contains both brace and colon, it is parsed twice (first
as key = value and second as start of section). This is handled by
continue in if section.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
2013-01-31 16:11:18 +01:00
Fabio M. Di Nitto
ed6bca3293 crypto: drop < 2.3 protocols and onwire compat
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2013-01-14 11:49:32 +01:00
Jan Friesse
dd588d004e Add option to specify ip version
Default is ipv4.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
2012-12-03 14:02:32 +01:00
Fabio M. Di Nitto
220d659b38 totemcrypto: implement crypto packet format 2.2 and crypto_compat: config opt
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2012-11-22 11:13:30 +01:00
Jan Friesse
3cd4f9a1f5 Add support for selecting IPC type
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
2012-11-08 12:16:11 +01:00
Fabio M. Di Nitto
20c5871525 totemcrypto: add support for different encryption methods
(backport from nsscrypto kronosnet code)

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2012-10-15 10:00:16 +02:00
Jan Friesse
6825c1d39b Parse config_version as 64-bit uint
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
2012-10-02 16:04:02 +02:00