From owner-freebsd-net@FreeBSD.ORG Wed Jun 25 09:43:26 2014 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D94AC769; Wed, 25 Jun 2014 09:43:25 +0000 (UTC) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "mail.citrix.com", Issuer "Cybertrust Public SureServer SV CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AB5D92150; Wed, 25 Jun 2014 09:43:24 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.01,544,1400025600"; d="scan'208,223";a="147116730" Received: from accessns.citrite.net (HELO FTLPEX01CL01.citrite.net) ([10.9.154.239]) by FTLPIPO01.CITRIX.COM with ESMTP; 25 Jun 2014 09:43:16 +0000 Received: from [IPv6:::1] (10.80.16.47) by smtprelay.citrix.com (10.13.107.78) with Microsoft SMTP Server id 14.3.181.6; Wed, 25 Jun 2014 05:43:14 -0400 Message-ID: <53AA99AF.4020205@citrix.com> Date: Wed, 25 Jun 2014 11:43:11 +0200 From: =?ISO-8859-15?Q?Roger_Pau_Monn=E9?= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: John Baldwin , Subject: Re: Ordering problem in if_detach_internal regarding if_bridge References: <53A4527F.90008@citrix.com> <53A85A8D.4090208@FreeBSD.org> <53A86016.5000102@citrix.com> <201406241306.40064.jhb@freebsd.org> In-Reply-To: <201406241306.40064.jhb@freebsd.org> X-Enigmail-Version: 1.6 Content-Type: multipart/mixed; boundary="------------010303040404000907010805" X-DLP: MIA2 Cc: "Alexander V. Chernikov" X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Jun 2014 09:43:26 -0000 --------------010303040404000907010805 Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: 8bit On 24/06/14 19:06, John Baldwin wrote: > On Monday, June 23, 2014 1:12:54 pm Roger Pau Monné wrote: >> I'm not getting the traffic from the dying interface, I'm getting the >> traffic from another interface on the bridge (a physical bce interface), >> which injects traffic into the bridge, that calls bridge_input, which >> tries to read ifp->if_addr->ifa_addr from the dying interface, and that >> leads to the panic. >> >> Line numbers: >> >> /usr/src/sys/modules/if_bridge/../../net/if_bridge.c:2410 (bridge_input) >> /usr/src/sys/net/if_ethersubr.c:543 (ether_input_internal) >> /usr/src/sys/net/netisr.c:972 (netisr_dispatch_src) >> /usr/src/sys/net/if_ethersubr.c:674 (ether_input) >> /usr/src/sys/dev/bce/if_bce.c:6861 (bce_rx_intr) > > I think this certainly suggests moving at least the eventhandler up so that > things like vlans and bridges can detach from an interface while it is still > constructed. I do think it would be ideal to move all three notifications > to the same place though. (So your original patch plus moving the > routing socket message.) OK, I have updated the patch, now the devctl_notify is also done in the same block. Let me know what you think about it. Roger. --------------010303040404000907010805 Content-Type: text/plain; charset="UTF-8"; x-mac-type=0; x-mac-creator=0; name="if_detach.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="if_detach.patch" >From a3fdee18fa3f0d8707bfbf2d9324e3103e1cede8 Mon Sep 17 00:00:00 2001 From: Roger Pau Monne Date: Fri, 20 Jun 2014 15:16:58 +0200 Subject: [PATCH] --- sys/net/if.c | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/sys/net/if.c b/sys/net/if.c index 47b5b9d..1c4bcab 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -875,6 +875,12 @@ if_detach_internal(struct ifnet *ifp, int vmove) #endif if_purgemaddrs(ifp); + /* Announce that the interface is gone. */ + rt_ifannouncemsg(ifp, IFAN_DEPARTURE); + EVENTHANDLER_INVOKE(ifnet_departure_event, ifp); + if (IS_DEFAULT_VNET(curvnet)) + devctl_notify("IFNET", ifp->if_xname, "DETACH", NULL); + if (!vmove) { /* * Prevent further calls into the device driver via ifnet. @@ -912,11 +918,6 @@ if_detach_internal(struct ifnet *ifp, int vmove) } } - /* Announce that the interface is gone. */ - rt_ifannouncemsg(ifp, IFAN_DEPARTURE); - EVENTHANDLER_INVOKE(ifnet_departure_event, ifp); - if (IS_DEFAULT_VNET(curvnet)) - devctl_notify("IFNET", ifp->if_xname, "DETACH", NULL); if_delgroups(ifp); /* -- 1.7.7.5 (Apple Git-26) --------------010303040404000907010805--