From owner-svn-src-all@freebsd.org Wed Oct 7 06:32:35 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 785FB9D1D5D; Wed, 7 Oct 2015 06:32:35 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2C6E8147; Wed, 7 Oct 2015 06:32:35 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t976WYXx006976; Wed, 7 Oct 2015 06:32:34 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t976WYmC006975; Wed, 7 Oct 2015 06:32:34 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201510070632.t976WYmC006975@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Wed, 7 Oct 2015 06:32:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288980 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 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, 07 Oct 2015 06:32:35 -0000 Author: hrs Date: Wed Oct 7 06:32:34 2015 New Revision: 288980 URL: https://svnweb.freebsd.org/changeset/base/288980 Log: Fix a bug that caused reinitialization failure of MAC addresses on the lagg interface when removing the primary port. PR: 201916 Differential Revision: https://reviews.freebsd.org/D3301 Modified: head/sys/net/if_lagg.c Modified: head/sys/net/if_lagg.c ============================================================================== --- head/sys/net/if_lagg.c Wed Oct 7 06:31:14 2015 (r288979) +++ head/sys/net/if_lagg.c Wed Oct 7 06:32:34 2015 (r288980) @@ -640,7 +640,7 @@ lagg_port_lladdr(struct lagg_port *lp, u /* Check to make sure its not already queued to be changed */ SLIST_FOREACH(llq, &sc->sc_llq_head, llq_entries) { - if (llq->llq_ifp == ifp) { + if (llq->llq_ifp == ifp && llq->llq_primary == primary) { pending = 1; break; } @@ -855,7 +855,7 @@ static int lagg_port_destroy(struct lagg_port *lp, int rundelport) { struct lagg_softc *sc = lp->lp_softc; - struct lagg_port *lp_ptr; + struct lagg_port *lp_ptr, *lp0; struct lagg_llq *llq; struct ifnet *ifp = lp->lp_ifp; uint64_t *pval, vdiff; @@ -897,18 +897,26 @@ lagg_port_destroy(struct lagg_port *lp, if (lp == sc->sc_primary) { uint8_t lladdr[ETHER_ADDR_LEN]; - if ((lp_ptr = SLIST_FIRST(&sc->sc_ports)) == NULL) { + if ((lp0 = SLIST_FIRST(&sc->sc_ports)) == NULL) { bzero(&lladdr, ETHER_ADDR_LEN); } else { - bcopy(lp_ptr->lp_lladdr, + bcopy(lp0->lp_lladdr, lladdr, ETHER_ADDR_LEN); } lagg_lladdr(sc, lladdr); - sc->sc_primary = lp_ptr; - /* Update link layer address for each port */ + /* + * Update link layer address for each port. No port is + * marked as primary at this moment. + */ SLIST_FOREACH(lp_ptr, &sc->sc_ports, lp_entries) lagg_port_lladdr(lp_ptr, lladdr); + /* + * Mark lp0 as the new primary. This invokes an + * iflladdr_event. + */ + sc->sc_primary = lp0; + lagg_port_lladdr(lp0, lladdr); } /* Remove any pending lladdr changes from the queue */