From owner-svn-src-all@FreeBSD.ORG Wed Jul 25 12:14:40 2012 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 50D50106564A; Wed, 25 Jul 2012 12:14:40 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3BF7D8FC08; Wed, 25 Jul 2012 12:14:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6PCEeSW056357; Wed, 25 Jul 2012 12:14:40 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6PCEe2u056355; Wed, 25 Jul 2012 12:14:40 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201207251214.q6PCEe2u056355@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Wed, 25 Jul 2012 12:14:40 +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: r238769 - 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: Wed, 25 Jul 2012 12:14:40 -0000 Author: bz Date: Wed Jul 25 12:14:39 2012 New Revision: 238769 URL: http://svn.freebsd.org/changeset/base/238769 Log: Fix a problem when CARP is enabled on the interface for IPv4 but not for IPv6. The current checks in nd6_nbr.c along with the old version will result in ifa being NULL and subsequently the packet will be dropped. This prevented NS/NA, from working and with that IPv6. Now return the ifa from the carp lookup function in two cases: 1) if the address matches, is a carp address, and we are MASTER (as before), 2) if the address matches but it is not a carp address at all (new). Reported by: Peter Wemm (new Y! FreeBSD cluster, eating our own dogfood) Tested on: New Y! FreeBSD cluster machines Reviewed by: glebius Modified: head/sys/netinet/ip_carp.c Modified: head/sys/netinet/ip_carp.c ============================================================================== --- head/sys/netinet/ip_carp.c Wed Jul 25 12:06:52 2012 (r238768) +++ head/sys/netinet/ip_carp.c Wed Jul 25 12:14:39 2012 (r238769) @@ -1027,23 +1027,31 @@ carp_send_na(struct carp_softc *sc) } } +/* + * Returns ifa in case it's a carp address and it is MASTER, or if the address + * matches and is not a carp address. Returns NULL otherwise. + */ struct ifaddr * carp_iamatch6(struct ifnet *ifp, struct in6_addr *taddr) { struct ifaddr *ifa; + ifa = NULL; IF_ADDR_RLOCK(ifp); - IFNET_FOREACH_IFA(ifp, ifa) - if (ifa->ifa_addr->sa_family == AF_INET6 && - ifa->ifa_carp->sc_state == MASTER && - IN6_ARE_ADDR_EQUAL(taddr, IFA_IN6(ifa))) { + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + if (ifa->ifa_addr->sa_family != AF_INET6) + continue; + if (!IN6_ARE_ADDR_EQUAL(taddr, IFA_IN6(ifa))) + continue; + if (ifa->ifa_carp && ifa->ifa_carp->sc_state != MASTER) + ifa = NULL; + else ifa_ref(ifa); - IF_ADDR_RUNLOCK(ifp); - return (ifa); - } + break; + } IF_ADDR_RUNLOCK(ifp); - return (NULL); + return (ifa); } caddr_t