Bug 80972

Summary: Destroying carp interface prevents carp from preempting ever again
Product: Base System Reporter: frank
Component: kernAssignee: Gleb Smirnoff <glebius>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   

Description frank 2005-05-13 12:30:01 UTC
This was discussed with Gleb Smirnoff but he does not have time to fix it. Here is the mail exchange:

  Frank,

good catch, thanks! I'll work on this next working day.

On Sun, May 01, 2005 at 12:05:02PM +0200, Frank wrote:
F> Hi Gleb,
F> 
F> I have found a bug in CARP. The problem exits if you are using 
F> preemption (net.inet.carp.preempt=1) and you destroy a carp interface 
F> that is currently down.
F> 
F> The counter carp_suppress_preempt counts the number of interfaces that 
F> are currently down. If this counter > 0 then the system will advertise 
F> with advskew 240.
F> 
F> The mechanism works fine, the counter is increased when the number of 
F> interfaces that is down increases, and decreases likewise. If the 
F> counter is 0 again, then de advskew of 240 is no longer used and the 
F> original advskew is used again.
F> 
F> The problem exists in the fact that if you destroy a CARP interface that 
F> is currently down, then the carp_suppress_preempt counter is never 
F> compenstated for that. After such an event the carp_suppress_preempt 
F> counter is always too large, and the system will use advskew forever.
F> 
F> This is fixed with the following patch (copy and pasted, so may not 
F> apply cleanly). It adds logic to carp_clone_destroy to decrease the 
F> counter if the interface is destoyed.
F> 
F> Please let me know what you think.
F> 
F> Regards,
F> 
F> Frank
F> 
F> 
F> 
F> Index: ip_carp.c
F> ===================================================================
F> RCS file: /home/cvs/firewall/FreeBSD/sys-5.4/netinet/ip_carp.c,v
F> retrieving revision 1.3
F> diff -u -r1.3 ip_carp.c
F> --- ip_carp.c   26 Apr 2005 10:55:06 -0000      1.3
F> +++ ip_carp.c   1 May 2005 09:49:37 -0000
F> @@ -405,6 +405,16 @@
F> 
F>  /*     carpdetach(sc); */
F> 
F> +       /*
F> +        * If an interface is destroyed which is suppressing the preemption,
F> +        * decrease the global counter, otherwise the host will never get
F> +        * out of the carp supressing state
F> +        */
F> +       if (sc->sc_suppress)
F> +               carp_suppress_preempt--;
F> +       sc->sc_suppress = 0;
F> +
F> +

-- Totus tuus, Glebius. GLEBIUS-RIPN GLEB-RIPE 

On Fri, May 06, 2005 at 11:20:59PM +0200, Frank wrote:
F> Did you have a look at this? I think it should be committed asap so it 
F> makes FreeBSD 5.4 release....

ENOTIME, sorry  :( 

The release tagging has already been done yesterday...

-- Totus tuus, Glebius. GLEBIUS-RIPN GLEB-RIPE

Fix: 

See patch
How-To-Repeat: See above
Comment 1 Gleb Smirnoff freebsd_committer freebsd_triage 2005-05-15 02:45:00 UTC
State Changed
From-To: open->patched

Committed, sorry for delay. 


Comment 2 Gleb Smirnoff freebsd_committer freebsd_triage 2005-05-15 02:45:00 UTC
Responsible Changed
From-To: freebsd-bugs->glebius

Committed, sorry for delay.
Comment 3 Gleb Smirnoff freebsd_committer freebsd_triage 2005-05-20 08:19:12 UTC
State Changed
From-To: patched->closed

Merged, thanks!