Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6398BC28CC0 for ; Wed, 29 May 2019 17:22:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3AAC723F25 for ; Wed, 29 May 2019 17:22:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726076AbfE2RWE (ORCPT ); Wed, 29 May 2019 13:22:04 -0400 Received: from orbyte.nwl.cc ([151.80.46.58]:40746 "EHLO orbyte.nwl.cc" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725917AbfE2RWE (ORCPT ); Wed, 29 May 2019 13:22:04 -0400 Received: from n0-1 by orbyte.nwl.cc with local (Exim 4.91) (envelope-from ) id 1hW2H0-0001IK-4N; Wed, 29 May 2019 19:21:58 +0200 Date: Wed, 29 May 2019 19:21:58 +0200 From: Phil Sutter To: David Ahern Cc: David Miller , netdev@vger.kernel.org Subject: Re: [net-next PATCH] net: rtnetlink: Enslave device before bringing it up Message-ID: <20190529172158.GE31548@orbyte.nwl.cc> Mail-Followup-To: Phil Sutter , David Ahern , David Miller , netdev@vger.kernel.org References: <20190529135120.32241-1-phil@nwl.cc> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Wed, May 29, 2019 at 09:41:07AM -0600, David Ahern wrote: > On 5/29/19 7:51 AM, Phil Sutter wrote: > > Unlike with bridges, one can't add an interface to a bond and set it up > > at the same time: > > > > | # ip link set dummy0 down > > | # ip link set dummy0 master bond0 up > > | Error: Device can not be enslaved while up. > > > > Of all drivers with ndo_add_slave callback, bond and team decline if > > IFF_UP flag is set, vrf cycles the interface (i.e., sets it down and > > immediately up again) and the others just don't care. > > > > Support the common notion of setting the interface up after enslaving it > > by sorting the operations accordingly. > > > > Signed-off-by: Phil Sutter > > --- > > net/core/rtnetlink.c | 14 +++++++------- > > 1 file changed, 7 insertions(+), 7 deletions(-) > > > > I agree with the intent - enslave before up. > > Not sure how likely this is, but it does break the case: > ip li set dummy0 master bond0 down That's right. I could allow for that by ordering the enslave and state change dynamically, but doubt it's worth the effort. Instead of the above I'd rather expect 'ip l s d0 nomaster down' to be a more common use-case (which is not affected by my patch). Thanks, Phil