From owner-svn-src-all@FreeBSD.ORG Mon Sep 6 21:06:06 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9AC1C10656C6; Mon, 6 Sep 2010 21:06:06 +0000 (UTC) (envelope-from will@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8AC578FC12; Mon, 6 Sep 2010 21:06:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o86L66GJ065392; Mon, 6 Sep 2010 21:06:06 GMT (envelope-from will@svn.freebsd.org) Received: (from will@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o86L667a065390; Mon, 6 Sep 2010 21:06:06 GMT (envelope-from will@svn.freebsd.org) Message-Id: <201009062106.o86L667a065390@svn.freebsd.org> From: Will Andrews Date: Mon, 6 Sep 2010 21:06:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212266 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2010 21:06:06 -0000 Author: will Date: Mon Sep 6 21:06:06 2010 New Revision: 212266 URL: http://svn.freebsd.org/changeset/base/212266 Log: Fix CARP in backup mode by properly registering its hooks for INET and INET6 using ipproto_{un,}register() and the newly created ip6proto_{un,}register() so that it can again receive IPPROTO_CARP packets allowing its state machine to work. Reviewed by: bz Approved by: ken (mentor) Modified: head/sys/netinet/ip_carp.c Modified: head/sys/netinet/ip_carp.c ============================================================================== --- head/sys/netinet/ip_carp.c Mon Sep 6 21:03:30 2010 (r212265) +++ head/sys/netinet/ip_carp.c Mon Sep 6 21:06:06 2010 (r212266) @@ -2313,6 +2313,7 @@ carp_mod_cleanup(void) if_clone_detach(&carp_cloner); #ifdef INET if (proto_reg[CARP_INET] == 0) { + (void)ipproto_unregister(IPPROTO_CARP); pf_proto_unregister(PF_INET, IPPROTO_CARP, SOCK_RAW); proto_reg[CARP_INET] = -1; } @@ -2320,6 +2321,7 @@ carp_mod_cleanup(void) #endif #ifdef INET6 if (proto_reg[CARP_INET6] == 0) { + (void)ip6proto_unregister(IPPROTO_CARP); pf_proto_unregister(PF_INET6, IPPROTO_CARP, SOCK_RAW); proto_reg[CARP_INET6] = -1; } @@ -2335,6 +2337,7 @@ carp_mod_cleanup(void) static int carp_mod_load(void) { + int err; if_detach_event_tag = EVENTHANDLER_REGISTER(ifnet_departure_event, carp_ifdetach, NULL, EVENTHANDLER_PRI_ANY); @@ -2357,6 +2360,12 @@ carp_mod_load(void) carp_mod_cleanup(); return (EINVAL); } + err = ip6proto_register(IPPROTO_CARP); + if (err) { + printf("carp: error %d registering with INET6\n", err); + carp_mod_cleanup(); + return (EINVAL); + } #endif #ifdef INET carp_iamatch_p = carp_iamatch; @@ -2367,6 +2376,12 @@ carp_mod_load(void) carp_mod_cleanup(); return (EINVAL); } + err = ipproto_register(IPPROTO_CARP); + if (err) { + printf("carp: error %d registering with INET\n", err); + carp_mod_cleanup(); + return (EINVAL); + } #endif return 0; }