# CARP on FreeBSD-10 and above: weird bug (virt and real hw)



## dekloper (Aug 4, 2016)

I greet the team.
Help me to understand.
I found a very strange bug..
I do failover on bsd the 10th branch and above ..
On both nodes 
	
	



```
net.inet.carp.preempt = 0
```
ie, if a backup has become a master, then they should be and regardless of restoring a link with the master (master became backup)
everything is working well.. on.. virtual machines..

I raise an identical structure (up to the revisions of the nucleus) on real hardware
behavior change
after the fall and the recovery wizard, the wizard takes the role of himself! why?? what changed??

Dump on backup node (the link to the master broke: advskew=100, ascended link: advskew=0)


```
09:45:02.247335 IP 10.51.51.2.17629 > 10.51.51.1.8457: Flags , seq 3416848289, win 65535, options [mss 1460,nop,wscale 6,sackOK,TS val 81032219 ecr 0], length 0
09:45:03.216271 IP 10.51.51.2 > 224.0.0.18: CARPv2-advertise 36: vhid=51 advbase=1 advskew=100 authlen=7 counter=10866415453460701816
09:45:04.671079 IP 10.51.51.2 > 224.0.0.18: CARPv2-advertise 36: vhid=51 advbase=1 advskew=100 authlen=7 counter=10866415453460701817
09:45:05.552327 IP 10.51.51.2.17629 > 10.51.51.1.8457: Flags , seq 3416848289, win 65535, options [mss 1460,nop,wscale 6,sackOK,TS val 81035524 ecr 0], length 0
09:45:06.149826 IP 10.51.51.2 > 224.0.0.18: CARPv2-advertise 36: vhid=51 advbase=1 advskew=100 authlen=7 counter=10866415453460701818
09:45:12.082079 IP 10.51.51.2.17629 > 10.51.51.1.8457: Flags , seq 3416848289, win 65535, options [mss 1460,nop,wscale 6,sackOK,TS val 81038767 ecr 0], length 0
09:45:12.082086 IP 10.51.51.2.17629 > 10.51.51.1.8457: Flags , seq 3416848289, win 65535, options [mss 1460,nop,wscale 6,sackOK,TS val 81042054 ecr 0], length 0
09:45:12.082305 ARP, Request who-has 10.51.51.2 tell 10.51.51.1, length 46
09:45:12.082323 ARP, Reply 10.51.51.2 is-at 0c:c4:7a:6f:06:03, length 28
09:45:12.082458 IP 10.51.51.1.8457 > 10.51.51.2.17629: Flags [S.], seq 2351575674, ack 3416848290, win 65535, options [mss 1460,nop,wscale 6,sackOK,TS val 592758101 ecr 81042054], length 0
09:45:12.082484 IP 10.51.51.2.17629 > 10.51.51.1.8457: Flags [.], ack 1, win 1026, options [nop,nop,TS val 81042054 ecr 592758101], length 0
09:45:12.082672 IP 10.51.51.2.17629 > 10.51.51.1.8457: Flags [P.], seq 1:58, ack 1, win 1026, options[nop,nop,TS val 81042054 ecr 592758101], length 57
09:45:12.082999 IP 10.51.51.1.8457 > 10.51.51.2.17629: Flags [F.], seq 114, ack 58, win 1026, options[nop,nop,TS val 592758102 ecr 81042054], length 0
09:45:12.083030 IP 10.51.51.2.17629 > 10.51.51.1.8457: Flags [.], ack 1, win 1026, options [nop,nop,TS val 81042055 ecr 592758101], length 0
09:45:12.083072 IP 10.51.51.1.8457 > 10.51.51.2.17629: Flags [P.], seq 1:114, ack 58, win 1026, options [nop,nop,TS val 592758102 ecr 81042054], length 113
09:45:12.083091 IP 10.51.51.2.17629 > 10.51.51.1.8457: Flags [.], ack 115, win 1024, options [nop,nop,TS val 81042055 ecr 592758102], length 0
09:45:12.083360 IP 10.51.51.2.17629 > 10.51.51.1.8457: Flags [F.], seq 58, ack 115, win 1026, options [nop,nop,TS val 81042055 ecr 592758102], length 0
09:45:12.083470 IP 10.51.51.1.8457 > 10.51.51.2.17629: Flags [.], ack 59, win 1026, options [nop,nop,TS val 592758102 ecr 81042055], length 0
09:45:14.294316 ARP, Request who-has 10.51.51.10 tell 10.51.51.10, length 46
09:45:14.294323 IP 10.51.51.1 > 224.0.0.18: CARPv2-advertise 36: vhid=51 advbase=1 advskew=0 authlen=7 counter=10866415453460701762
09:45:14.294336 ARP, Reply 10.51.51.10 is-at 0c:c4:7a:6f:06:03, length 28
09:45:15.357616 IP 10.51.51.1 > 224.0.0.18: CARPv2-advertise 36: vhid=51 advbase=1 advskew=0 authlen=7 counter=10866415453460701763
09:45:16.419314 IP 10.51.51.1 > 224.0.0.18: CARPv2-advertise 36: vhid=51 advbase=1 advskew=0 authlen=7 counter=10866415453460701764
09:45:17.451307 IP 10.51.51.1 > 224.0.0.18: CARPv2-advertise 36: vhid=51 advbase=1 advskew=0 authlen=7 counter=10866415453460701765
```

On virtual machines similar to dump on the backup node unit shows when falling master advskew = 100, when restoring the network connection with master node, advskew = 100 is true (backup, has become a master, and it still is)

why? what happened?


----------

