]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
carp: deal with negative net.inet.carp.demotion
authorMarius Halden <marius.halden@modirum.com>
Sun, 31 Oct 2021 20:18:42 +0000 (21:18 +0100)
committerKristof Provost <kp@FreeBSD.org>
Mon, 1 Nov 2021 16:08:23 +0000 (17:08 +0100)
commit1019354b54161c140d10a8203ff1e849c09c8010
tree6f778a524abe038c905f878c4939cd88645e7a30
parentdde6071adcf203b185c185289f687c2bd51532fb
carp: deal with negative net.inet.carp.demotion

Given nodes 1 and 2, where node 1 has an advskew of 0 and node 2 has an
advskew of 100, making them master and backup respectively.

If net.inet.carp.demotion is set to a negative value on node 1, node 2
might become master while node 1 still retains it master status. Wether
or not node 2 becomes master seems to depend on the nodes advskew and
what the demotion sysctl was set to on node 1.

The reason for node 2 becoming master seems to be that the calculated
advskew taking demotion into account is truncated to a single unsigned
byte when copied into the carp header for sending, and node 1 stays
master since it takes uses the whole non-truncated calculated advskew
when deciding wether to stay master.

PR: 259528
Reviewed by: donner, glebius
MFC after: 3 weeks
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D32759
sys/netinet/ip_carp.c