From owner-freebsd-net@FreeBSD.ORG Mon Aug 5 11:20:44 2013 Return-Path: Delivered-To: freebsd-net@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 1AABDD61 for ; Mon, 5 Aug 2013 11:20:44 +0000 (UTC) (envelope-from rnewpol@panasas.com) Received: from natasha.panasas.com (natasha.panasas.com [67.152.220.90]) by mx1.freebsd.org (Postfix) with ESMTP id D272527FD for ; Mon, 5 Aug 2013 11:20:43 +0000 (UTC) Received: from zenyatta.panasas.com (zenyatta.int.panasas.com [172.17.28.63]) by natasha.panasas.com (8.13.1/8.13.1) with ESMTP id r75BKaS0020984 for ; Mon, 5 Aug 2013 07:20:36 -0400 Received: from ZENYATTA.int.panasas.com ([fe80::44ca:f0e1:b97e:bf79]) by zenyatta.int.panasas.com ([fe80::44ca:f0e1:b97e:bf79%15]) with mapi id 14.01.0438.000; Mon, 5 Aug 2013 07:20:36 -0400 From: "Newpol, Richard" To: "freebsd-net@freebsd.org" Subject: RE: Adding an address to a downed LAGG interface breaks it? Thread-Topic: Adding an address to a downed LAGG interface breaks it? Thread-Index: Ac6O0kNU3I+mB/omSF2T80LhN/f9IAClM6uAABmYI9U= Date: Mon, 5 Aug 2013 11:20:35 +0000 Message-ID: <1A778AD3F807B340B7EB1BD1B9C196773D6566C8@zenyatta.int.panasas.com> References: <1A778AD3F807B340B7EB1BD1B9C196773D655FE6@zenyatta.int.panasas.com>, In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.17.28.30] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Aug 2013 11:20:44 -0000 By "inconsistent state" i just mean that the driver is not actually up, but= the IFF_UP flag is set. The problem is that when the interface is brought = up by the user after that (ifconfig lagg0 up), the part of the code that ad= ds the default subnet broadcast routes checks IFF_UP and sees it is set, so= it skips the route adds. Normally, the route adds (and a few other things)= are done before the IFF_UP flag is set.=0A= =0A= Rich Newpol=0A= Panasas=0A= ________________________________________=0A= From: Rui Paulo [rpaulo@FreeBSD.org]=0A= Sent: Sunday, August 04, 2013 3:05 PM=0A= To: Newpol, Richard=0A= Cc: freebsd-net@freebsd.org=0A= Subject: Re: Adding an address to a downed LAGG interface breaks it?=0A= =0A= On 1 Aug 2013, at 09:22, "Newpol, Richard" wrote:=0A= =0A= > All,=0A= > We seem to have discovered a problem that occurs when adding an address (= or alias) to a DOWNed lagg interface. After adding an address, when you try= to bring the interface UP it can't reach the desired networks.=0A= >=0A= > Turns out that the problem occurs because the lagg driver silently passes= the SIOCSIFADDR ioctl to the "ether_ioctl" handler, which in turn always s= ets the IFF_UP flag.=0A= >=0A= > While this is usually ok (since ifconfig
implies UP with t= he first assigned address anyway), the lagg driver does not have the proper= handling to actually change state to UP on the first address, so it ends u= p in an inconsistent state. Then, when the user eventually does an "ifconfi= g lagg up" the default subnet routes are not added (because the "interface = up" code sees that IFF_UP is already set).=0A= >=0A= > So my first question - is this a known problem, or has it been addressed = in some other way?=0A= >=0A= > Secondly, I can think of two ways to fix this, and was wondering what are= the implications. The first way would be for the lagg driver to correctly = bring itself up when the first address is added to it. The second way would= be for the lagg driver to preserve the state of IFF_FLAG when handling SIO= CSIFADDR. I like the second way because it is less of an overall behaviour = change from the current, but the first way seems more correct.=0A= =0A= =0A= After you add the first address, you said it comes to an inconsistent state= . Can you clarify?=0A= =0A= The first approach seems like the right fix but I don't know much about the= problem. The second way breaks the POLA because you're special casing lagg= just to work around a bug.=0A= =0A= --=0A= Rui Paulo=0A= =0A=