From patchwork Fri Dec 28 06:28:54 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: stephen hemminger X-Patchwork-Id: 208415 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 6B13F2C007E for ; Fri, 28 Dec 2012 17:30:22 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751162Ab2L1GaR (ORCPT ); Fri, 28 Dec 2012 01:30:17 -0500 Received: from mail.vyatta.com ([76.74.103.46]:40101 "EHLO mail.vyatta.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750826Ab2L1GaP (ORCPT ); Fri, 28 Dec 2012 01:30:15 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.vyatta.com (Postfix) with ESMTP id 2C8E3141053D; Thu, 27 Dec 2012 22:30:15 -0800 (PST) X-Virus-Scanned: amavisd-new at tahiti.vyatta.com Received: from mail.vyatta.com ([127.0.0.1]) by localhost (mail.vyatta.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id h-EWGbIO0Cdo; Thu, 27 Dec 2012 22:30:14 -0800 (PST) Received: from nehalam.linuxnetplumber.net (static-50-53-80-93.bvtn.or.frontiernet.net [50.53.80.93]) by mail.vyatta.com (Postfix) with ESMTPSA id 4110F141022C; Thu, 27 Dec 2012 22:30:14 -0800 (PST) Date: Thu, 27 Dec 2012 22:28:54 -0800 From: Stephen Hemminger To: David Miller Cc: netdev@vger.kernel.org Subject: [PATCH net-next] bridge: respect RFC2863 operational state Message-ID: <20121227222854.6ec132dd@nehalam.linuxnetplumber.net> Organization: Vyatta Mime-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The bridge link detection should follow the operational state of the lower device, rather than the carrier bit. This allows devices like tunnels that are controlled by userspace control plane to work with bridge STP link management. Signed-off-by: Stephen Hemminger Reviewed-by: Jiri Pirko --- 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 --- a/net/bridge/br_if.c 2012-10-25 09:11:15.627272524 -0700 +++ b/net/bridge/br_if.c 2012-12-14 08:58:14.329847361 -0800 @@ -66,14 +66,14 @@ void br_port_carrier_check(struct net_br struct net_device *dev = p->dev; struct net_bridge *br = p->br; - if (netif_running(dev) && netif_carrier_ok(dev)) + if (netif_running(dev) && netif_oper_up(dev)) p->path_cost = port_cost(dev); if (!netif_running(br->dev)) return; spin_lock_bh(&br->lock); - if (netif_running(dev) && netif_carrier_ok(dev)) { + if (netif_running(dev) && netif_oper_up(dev)) if (p->state == BR_STATE_DISABLED) br_stp_enable_port(p); } else { --- a/net/bridge/br_notify.c 2012-10-25 09:11:15.631272484 -0700 +++ b/net/bridge/br_notify.c 2012-12-14 08:57:36.954222724 -0800 @@ -82,7 +82,7 @@ static int br_device_event(struct notifi break; case NETDEV_UP: - if (netif_carrier_ok(dev) && (br->dev->flags & IFF_UP)) { + if (netif_running(br->dev) && netif_oper_up(dev)) { spin_lock_bh(&br->lock); br_stp_enable_port(p); spin_unlock_bh(&br->lock);