carp0 interface goes down on 6.2-PRERELEASE

Ari Suutari ari at suutari.iki.fi
Fri Oct 13 12:14:10 UTC 2006


Hi,

Tom Judge wrote:
> Ari Suutari wrote:
>> Ari Suutari wrote:
>>>     I have now tested with real hardware (ethernet is fxp0) and
>>>     under VmWare (ethernet is lnc0). Same problem on both.
>>
>>     I'll have to correct this. Carp works with fxp0. Problem is
>>     only under vmware, which makes me more and more suspect
>>     that it is because lnc0 does not support link state reporting
>>     (it seems to be present on only a few drivers).
>>
> I do remember seeing this problem when developing some systems in vmware 
> that the carp interfaces where always in INIT when the system booted. I 
> added a small rc script to for the interfaces up using 'ifconfig carp0 
> up'  which seemed to make the interfaces come up however if on system is 
> unplugged from the network it will automatically put itself into the 
> master state until it can talk to the other servers in the carp group.
> 


I already found the problem, it is in netinet/ip_carp.c.
Since lnc driver doesn't support link state, the state is
always LINK_STATE_UNKNOWN and carp code doesn't understand this.

Following patch fixes it for me:

cvs diff: Diffing .
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;



	Ari S.



More information about the freebsd-stable mailing list