Hi, When an unicast address is specified for carppeer, if the peer is down, sending out advertisemnent packets will fail, this failure is treated as an error of the sending host, then the error counter is incremented and carpdemote is incremenated. I think this is not correct because the failure is not a fault of the sending host.
ok? Don't treat an error if carppeer is an unicast and the peer is down. Index: sys/netinet/ip_carp.c =================================================================== RCS file: /cvs/src/sys/netinet/ip_carp.c,v retrieving revision 1.347 diff -u -p -r1.347 ip_carp.c --- sys/netinet/ip_carp.c 24 Jul 2020 18:17:15 -0000 1.347 +++ sys/netinet/ip_carp.c 25 Jul 2020 07:16:42 -0000 @@ -1140,7 +1140,9 @@ carp_send_ad(struct carp_vhost_entry *vh error = ip_output(m, NULL, NULL, IP_RAWOUTPUT, &sc->sc_imo, NULL, 0); - if (error) { + if (error && + /* when unicast, the peer's down is not our fault */ + !(!IN_MULTICAST(sc->sc_peer.s_addr) && error == EHOSTDOWN)){ if (error == ENOBUFS) carpstat_inc(carps_onomem); else