Bug 250257 - CARP: preempt not working when net.inet.carp.demotion is not zero
Summary: CARP: preempt not working when net.inet.carp.demotion is not zero
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 12.1-STABLE
Hardware: amd64 Any
: --- Affects Some People
Assignee: freebsd-net (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-10-10 18:16 UTC by Ozkan KIRIK
Modified: 2020-10-11 07:36 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ozkan KIRIK 2020-10-10 18:16:24 UTC
I'm using FreeBSD 12.1-STABLE. 
carp works as expected while all cables are plugged (demotion=0).
But when cables unplugged from one interface from each host (demotion=240 both), after unplugging one more cable from Host A, preempt dont work. so some interfaces left MASTER some of BACKUP at Host B.

Host A: Master
igb0 - vhid 226 - advskew 0 - carp: INIT - unplugged 
igb1 - vhid 227 - advskew 0 - carp: MASTER - plugged
igb2 - vhid 228 - advskew 0 - carp: INIT - unplugged both hosts
igb3 - vhid 229 - advskew 0 - carp: MASTER - plugged
net.inet.carp.preempt=1
net.inet.carp.demotion=480

# ifconfig igb1
igb1: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=e527bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,TSO6,LRO,WOL_MAGIC,VLAN_HWFILTER,VLAN_HWTSO,RXCSUM_IPV6,TXCSUM_IPV6>
        ether 0c:c4:7a:33:d0:6d
        inet6 fe80::ec4:7aff:fe33:d06d%igb1 prefixlen 64 scopeid 0x2
        inet 10.0.0.2 netmask 0xffffff00 broadcast 10.10.99.255
        inet 10.0.0.1 netmask 0xffffff00 broadcast 10.10.99.255 vhid 227
        groups: lanlar
        carp: MASTER vhid 227 advbase 1 advskew 0
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>

-------------------------------------------------------------------------

Host B: Backup
igb0 - vhid 226 - advskew 100 - carp: MASTER - plugged
igb1 - vhid 227 - advskew 100 - carp: BACKUP - plugged
igb2 - vhid 228 - advskew 100 - carp: INIT - unplugged both hosts
igb3 - vhid 229 - advskew 100 - carp: BACKUP - plugged
net.inet.carp.preempt=1
net.inet.carp.demotion=240

# ifconfig igb1
igb1: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=e527bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,TSO6,LRO,WOL_MAGIC,VLAN_HWFILTER,VLAN_HWTSO,RXCSUM_IPV6,TXCSUM_IPV6>
        ether 0c:c4:7a:33:d0:6d
        inet6 fe80::ec4:7aff:fe33:d06d%igb1 prefixlen 64 scopeid 0x2
        inet 10.0.0.3 netmask 0xffffff00 broadcast 10.10.99.255
        inet 10.0.0.1 netmask 0xffffff00 broadcast 10.10.99.255 vhid 227
        groups: lanlar
        carp: MASTER vhid 227 advbase 1 advskew 0
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>

-------------------------------------------------------------------------

This behaviour is wrong. Host B should preempt to become master.
In this condition the Host A should announce advskew=480 but announcing as advskew=240.

on Host B; tcpdump -ni igb1 -T carp carp shows that:
21:10:31.394012 IP 10.0.0.2 > 224.0.0.18: CARPv2-advertise 36: vhid=227 advbase=1 advskew=240 authlen=7 counter=248643719741960624

As seen above, Host A is still announcing as advskew=240.
There is something wrong when net.inet.carp.demotion from 240 to 480, announcement cannot switch to 480.