From patchwork Fri Apr 4 14:56:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 337010 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 68E0D1400B0 for ; Sat, 5 Apr 2014 01:56:13 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753603AbaDDO4J (ORCPT ); Fri, 4 Apr 2014 10:56:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:29816 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753521AbaDDO4H (ORCPT ); Fri, 4 Apr 2014 10:56:07 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s34Eu6s8026699 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 4 Apr 2014 10:56:06 -0400 Received: from [10.3.225.175] (vpn-225-175.phx2.redhat.com [10.3.225.175]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s34Eu6bT007977; Fri, 4 Apr 2014 10:56:06 -0400 Message-ID: <1396623382.15118.6.camel@dcbw.local> Subject: [RFC PATCH] bridge: remove !IFF_UP restriction when deleting bridge from ioctl From: Dan Williams To: Stephen Hemminger Cc: netdev@vger.kernel.org Date: Fri, 04 Apr 2014 09:56:22 -0500 Mime-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org netlink doesn't care about IFF_UP when deleting a bridge, so "ip link del br0" works just fine. The ioctl does care, which means that brctl complains "bridge br0 still up; can't delete it". Make things consistent by always allowing bridge deletion even if the bridge is up. Signed-off-by: Dan Williams --- Question: does anyone consider the ioctl behavior API? Can we change it even though it's been this way forever? It means that bridges that previously would not have been deleted by brctl will now be deleted. But anyone using /sbin/ip could already delete them. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index 54d207d..33cd83f 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c @@ -264,19 +264,14 @@ int br_del_bridge(struct net *net, const char *name) ret = -ENXIO; /* Could not find device */ else if (!(dev->priv_flags & IFF_EBRIDGE)) { /* Attempt to delete non bridge device! */ ret = -EPERM; } - else if (dev->flags & IFF_UP) { - /* Not shutdown yet. */ - ret = -EBUSY; - } - else br_dev_delete(dev, NULL); rtnl_unlock(); return ret; }