From nobody Fri Oct 29 12:58:37 2021 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D71F21828C4F for ; Fri, 29 Oct 2021 12:58:37 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgjCx5PxKz4dvY for ; Fri, 29 Oct 2021 12:58:37 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9688B174D9 for ; Fri, 29 Oct 2021 12:58:37 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 19TCwbI8099611 for ; Fri, 29 Oct 2021 12:58:37 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 19TCwbeg099610 for bugs@FreeBSD.org; Fri, 29 Oct 2021 12:58:37 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 259528] [carp] Backup node becomes second active master when master have some negative demotion values Date: Fri, 29 Oct 2021 12:58:37 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: marius.halden@modirum.com X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D259528 Bug ID: 259528 Summary: [carp] Backup node becomes second active master when master have some negative demotion values Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: marius.halden@modirum.com Created attachment 229121 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D229121&action= =3Dedit reproduction.sh Given nodes 1 and 2, where node 1 has an advskew of 0 and node 2 has an adv= skew 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 no= de 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 advsk= ew taking demotion into account is truncated to a single unsigned byte when co= pied into the carp header for sending[0], and node 1 stays master since it takes uses the whole non-truncated calculated advskew when deciding wether to stay master[1]. To reproduce, make sure carp support is enabled (kernel module loaded or bu= ilt in), then run attached reproduction case. Expected output from reproduction script when setting a negative demotion on the master: ># sh carp-test.sh >Staring jail carp1. >Staring jail carp2. > >Waiting for things to settle... > >carp1 status: MASTER >carp2 status: BACKUP > >decreasing carp demotion in carp1 jail >net.inet.carp.demotion: 0 -> -1 > >Waiting for things to settle... > >carp1 status: MASTER >carp2 status: BACKUP > >increasing carp demotion in carp1 jail >net.inet.carp.demotion: -1 -> 0 > >Waiting for things to settle... > >carp1 status: MASTER >carp2 status: BACKUP > >Cleaning up. Output actually seen when running the script: ># sh carp-test.sh >Staring jail carp1. >Staring jail carp2. > >Waiting for things to settle... > >carp1 status: MASTER >carp2 status: BACKUP > >decreasing carp demotion in carp1 jail >net.inet.carp.demotion: 0 -> -1 > >Waiting for things to settle... > >carp1 status: MASTER >carp2 status: MASTER > >increasing carp demotion in carp1 jail >net.inet.carp.demotion: -1 -> 0 > >Waiting for things to settle... > >carp1 status: MASTER >carp2 status: BACKUP > >Cleaning up. As shown, both carp nodes become master at the same time. [0] https://cgit.freebsd.org/src/tree/sys/netinet/ip_carp.c?id=3D130aebbab0d38d= a85f7d32b6d4227f95a2cd9ec7#n931 [1] https://cgit.freebsd.org/src/tree/sys/netinet/ip_carp.c?id=3D130aebbab0d38d= a85f7d32b6d4227f95a2cd9ec7#n736 --=20 You are receiving this mail because: You are the assignee for the bug.=