From asu@guinness.syncrontech.com  Fri Oct 13 12:21:09 2006
Return-Path: <asu@guinness.syncrontech.com>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 5F44016A415
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 13 Oct 2006 12:21:09 +0000 (UTC)
	(envelope-from asu@guinness.syncrontech.com)
Received: from espresso2.syncrontech.com (sync-old.syncrontech.com [213.28.98.35])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 8C7DA43D80
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 13 Oct 2006 12:21:05 +0000 (GMT)
	(envelope-from asu@guinness.syncrontech.com)
Received: from guinness.syncrontech.com (guinness.syncrontech.com [62.71.8.57])
	by espresso2.syncrontech.com (8.13.1/8.13.1) with ESMTP id k9DCL3rx049802
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 13 Oct 2006 15:21:03 +0300 (EEST)
	(envelope-from asu@guinness.syncrontech.com)
Received: from guinness.syncrontech.com (localhost.syncrontech.com [127.0.0.1])
	by guinness.syncrontech.com (8.13.4/8.13.4) with ESMTP id k9DCL3Mh014156
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 13 Oct 2006 15:21:03 +0300 (EEST)
	(envelope-from asu@guinness.syncrontech.com)
Received: (from asu@localhost)
	by guinness.syncrontech.com (8.13.4/8.13.4/Submit) id k9DCL3DR014155;
	Fri, 13 Oct 2006 15:21:03 +0300 (EEST)
	(envelope-from asu)
Message-Id: <200610131221.k9DCL3DR014155@guinness.syncrontech.com>
Date: Fri, 13 Oct 2006 15:21:03 +0300 (EEST)
From: Ari Suutari <ari.suutari@syncrontech.com>
Reply-To: Ari Suutari <ari.suutari@syncrontech.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: CARP interface doesn't go up on VmWare
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         104377
>Category:       kern
>Synopsis:       [carp] [patch] CARP interface doesn't go up on VmWare
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Oct 13 12:30:20 GMT 2006
>Closed-Date:    Mon Dec 04 15:38:32 GMT 2006
>Last-Modified:  Mon Dec 04 15:38:32 GMT 2006
>Originator:     Ari Suutari
>Release:        FreeBSD 6.2-PRERELEASE i386
>Organization:
Syncron Tech Oy
>Environment:
FreeBSD glass.syncrontech.com 6.2-PRERELEASE FreeBSD 6.2-PRERELEASE #0: Fri Oct 13 14:23:21 EEST 2006     asu@glass.syncrontech.com:/usr/src/sys/i386/compile/CARP_GENERIC  i386


>Description:
	When using CARP on system where physical network interface doesn't
	support link stat reporting, carp device doesn't go up during boot.
	One can manually up it, but it requires a additional script to be
	run during boot.

	This is problem at least under VmWare, but should occur also with
	older network cards.

>How-To-Repeat:
	Put following lines into /etc/rc.conf on VmWare guest machine:

	cloned_interfaces="carp0"
	ifconfig_carp0="inet 192.168.5.59/24 vhid 55 pass xxx123"

	Reboot the machine. After machine is up, run ifconfig carp0. 
	It displays that interface is not up, and it is in INIT state.


>Fix:

	Apply following patch. It changes the bahaviour of CARP so that
	it assumes that link is UP unless specifically told by physical
	interface that it is down (ie. handle LINK_STATE_UNKNOWN
	more gracefully).

	I tested this under VmWare (ie. lnc interface) and under 
	real machine (fxp ethernet interface - supports link
	state reporting, as far as I understad). Both worked ok.



Index: ip_carp.c
===================================================================
RCS file: /opt/freebsd-cvs/src/sys/netinet/ip_carp.c,v
retrieving revision 1.27.2.8
diff -c -r1.27.2.8 ip_carp.c
*** ip_carp.c	25 Sep 2006 13:01:59 -0000	1.27.2.8
--- ip_carp.c	13 Oct 2006 11:11:08 -0000
***************
*** 2116,2122 ****
  {
  	CARP_SCLOCK_ASSERT(sc);
  
! 	if (sc->sc_carpdev->if_link_state != LINK_STATE_UP ||
  	    !(sc->sc_carpdev->if_flags & IFF_UP)) {
  		sc->sc_flags_backup = SC2IFP(sc)->if_flags;
  		SC2IFP(sc)->if_flags &= ~IFF_UP;
--- 2116,2122 ----
  {
  	CARP_SCLOCK_ASSERT(sc);
  
! 	if (sc->sc_carpdev->if_link_state == LINK_STATE_DOWN ||
  	    !(sc->sc_carpdev->if_flags & IFF_UP)) {
  		sc->sc_flags_backup = SC2IFP(sc)->if_flags;
  		SC2IFP(sc)->if_flags &= ~IFF_UP;

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: glebius 
State-Changed-When: Mon Dec 4 15:34:00 UTC 2006 
State-Changed-Why:  
I am sorry, but I am not going to commit this patch. Let me explain. 
CARP is not going to work properly on interfaces that do not report 
its state being changed. The proposed patch will change CARP behavior 
to be pretending to work when interface doesn't support reporting 
its link state. I think it is better to refuse to work earlier, then 
pretend to be working but don't provide any redundancy. The proposed 
patch is going to confuse people. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=104377 
>Unformatted:
