From owner-freebsd-stable@FreeBSD.ORG Sat Oct 1 09:04:11 2011 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8852F106566B for ; Sat, 1 Oct 2011 09:04:11 +0000 (UTC) (envelope-from joh.hendriks@gmail.com) Received: from mail-ey0-f182.google.com (mail-ey0-f182.google.com [209.85.215.182]) by mx1.freebsd.org (Postfix) with ESMTP id 1CD718FC0A for ; Sat, 1 Oct 2011 09:04:10 +0000 (UTC) Received: by eyg7 with SMTP id 7so2180146eyg.13 for ; Sat, 01 Oct 2011 02:04:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=MrMmAqlQysfnEkOc428qU8Wqz3P/lfU7fjWA/o6OKRI=; b=hxmiSrE/wV2HP5lqAI3ehl/rvxSWqGj1v22cLPOtOVk9WW8kmc1Gr5gSi8XVoVSD9g O1xfiw/ptpV3LcFpPFIbup8kaIAgNalfO9yJTRSm5TDdaM9KS6aD+2dAOtC96ejUdFsl /dgdzjhqQpowypPLOCdoDJIWs65l+79LiTcFk= Received: by 10.213.113.194 with SMTP id b2mr171918ebq.129.1317459849977; Sat, 01 Oct 2011 02:04:09 -0700 (PDT) Received: from [192.168.1.13] (5ED0E470.cm-7-1d.dynamic.ziggo.nl. [94.208.228.112]) by mx.google.com with ESMTPS id z54sm14454631eef.2.2011.10.01.02.04.08 (version=SSLv3 cipher=OTHER); Sat, 01 Oct 2011 02:04:08 -0700 (PDT) Message-ID: <4E86D787.9050207@gmail.com> Date: Sat, 01 Oct 2011 11:04:07 +0200 From: johan Hendriks User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.23) Gecko/20110922 Thunderbird/3.1.15 MIME-Version: 1.0 To: Damien Fleuriot , freebsd-stable@freebsd.org References: <4E71C059.5060404@hi-media.com> <4E84627B.2050609@my.gd> <4E848592.5050300@my.gd> In-Reply-To: <4E848592.5050300@my.gd> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Subject: Re: CARP interfaces and mastership issue X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Oct 2011 09:04:11 -0000 Op 29-09-11 16:49, Damien Fleuriot schreef: >> >> >> Quick follow-up again. >> >> This is the code for sys/netinet/ip_carp.c on FreeBSD 8.2, OpenBSD >> 3.8, OpenBSD 3.9 in function carp_setrun(struct carp_softc *sc, >> sa_family_t af) >> >> >> >> FREEBSD 8.2-PRERELEASE with init + preempt => auto MASTER bug >> Function starts at line 1371. >> --- >> switch (sc->sc_state) { >> case INIT: >> if (carp_opts[CARPCTL_PREEMPT]&& !carp_suppress_preempt) { >> carp_send_ad_locked(sc); >> carp_send_arp(sc); >> #ifdef INET6 >> carp_send_na(sc); >> #endif /* INET6 */ >> CARP_LOG("%s: INIT -> MASTER (preempting)\n", >> SC2IFP(sc)->if_xname); >> carp_set_state(sc, MASTER); >> carp_setroute(sc, RTM_ADD); >> } else { >> CARP_LOG("%s: INIT -> BACKUP\n", SC2IFP(sc)->if_xname); >> carp_set_state(sc, BACKUP); >> carp_setroute(sc, RTM_DELETE); >> carp_setrun(sc, 0); >> } >> break; >> --- >> >> OPENBSD 3.8 with init + preempt => auto MASTER bug >> Function starts at line 1293. >> --- >> case INIT: >> if (carp_opts[CARPCTL_PREEMPT]&& !carp_suppress_preempt) { >> carp_set_state(sc, MASTER); >> carp_setroute(sc, RTM_ADD); >> carp_send_ad(sc); >> carp_send_arp(sc); >> #ifdef INET6 >> carp_send_na(sc); >> #endif /* INET6 */ >> } else { >> carp_set_state(sc, BACKUP); >> carp_setroute(sc, RTM_DELETE); >> carp_setrun(sc, 0); >> } >> break; >> --- >> >> >> >> OPENBSD 3.9 with bug fixed >> Function starts at line 1348. >> --- >> switch (sc->sc_state) { >> case INIT: >> carp_set_state(sc, BACKUP); >> carp_setroute(sc, RTM_DELETE); >> carp_setrun(sc, 0); >> break; >> --- >> >> >> It looks like the root cause is there. >> >> I'll rebuild and test, keep you updated. > > > > Find below my test results with the OpenBSD39 implementation which > forces an INIT -> BACKUP transition regardless of preempt. > > > > > > > # sysctl net.inet.carp.preempt > net.inet.carp.preempt: 1 > > # sysctl net.inet.carp.suppress_preempt > net.inet.carp.suppress_preempt: 0 > > # ifconfig carp17 > carp17: flags=8 metric 0 mtu 1500 > inet 46.182.[snip] netmask 0xffffffff > inet 46.182.[snip] netmask 0xffffffff > inet 46.182.[snip] netmask 0xffffffff > inet 46.182.[snip] netmask 0xffffffff > inet 46.182.[snip] netmask 0xffffffff > carp: INIT vhid 117 advbase 1 advskew 200 > > # ifconfig carp17 up; ./check_carp17_status.sh > count: 0 carp: BACKUP vhid 117 advbase 1 advskew 200 > count: 1 carp: BACKUP vhid 117 advbase 1 advskew 200 > count: 2 carp: BACKUP vhid 117 advbase 1 advskew 200 > count: 3 carp: BACKUP vhid 117 advbase 1 advskew 200 > count: 4 carp: BACKUP vhid 117 advbase 1 advskew 200 > count: 5 carp: BACKUP vhid 117 advbase 1 advskew 200 > count: 6 carp: BACKUP vhid 117 advbase 1 advskew 200 > count: 7 carp: BACKUP vhid 117 advbase 1 advskew 200 > count: 8 carp: BACKUP vhid 117 advbase 1 advskew 200 > count: 9 carp: BACKUP vhid 117 advbase 1 advskew 200 > count: 10 carp: BACKUP vhid 117 advbase 1 advskew 200 > > # dmesg > carp17: INIT -> BACKUP > carp17: link state changed to DOWN > > > > Looks like it works. > > I'm afraid I cannot test actual preemption by shutting down a physical > interface on the MASTER, because they're actually used in production and > I've got users logged in to their VPN on pf1. > > I see no reason this should break anything however, it only forces the > CARP interface to assume a BACKUP state right after INIT, as it normally > should, regardless of preemption. > > I'm filling a PR + patch. > _______________________________________________ > freebsd-stable@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-stable > To unsubscribe, send any mail to "freebsd-stable-unsubscribe@freebsd.org" Do you have the PR number for me and the patch, i have the same problem and like it to be fixed. regards Johan Hendriks