From patchwork Wed Sep 6 22:24:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Zhou X-Patchwork-Id: 810818 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xndSN60mHz9s82 for ; Thu, 7 Sep 2017 08:25:07 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 66A5DBD4; Wed, 6 Sep 2017 22:25:06 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 034C4B7B for ; Wed, 6 Sep 2017 22:25:05 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf0-f196.google.com (mail-pf0-f196.google.com [209.85.192.196]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 3A97F432 for ; Wed, 6 Sep 2017 22:25:04 +0000 (UTC) Received: by mail-pf0-f196.google.com with SMTP id f84so1731568pfj.3 for ; Wed, 06 Sep 2017 15:25:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id :content-transfer-encoding; bh=HmkiOdAS/BqMvlCzKyuzSO9k3wniyhKVnzCKOtts4Ek=; b=EXyrvU+8RtzCZGUY/VXJyAxOg/l6xzQ0m+DTmaHHnnspddnzpbU6Xu6g5k7/HvG1+S O2oO5FF7rQ/e1G2bLJZC4vAH5S8CNBrqgSEqJBTB7+MkMgcs8Ng8SJQG/QL6mZHbKh2X AvJGtllO7XYU81wrlwwpiKD23CEDOd0CVgA4XJYYdqZrXs/DrD3i9KKTDklUZThyUpff QtCtmMdHfviMC+o7ZVVWUuZOi5jUE35l9UyyaA4xagEEvQh2SsAixNX5rLUQ2KYlsn4g WKv5afxUMQrTNtYGEWXJpTsUwYOubexWkypoqkOcIvjDo5SowomIAu1tRKH6tfuf4suS 9fvQ== X-Gm-Message-State: AHPjjUim5k19J+A1i6mO6REr/Ee9NUlske9tUUWcNz5ugQH5E2ESPC4S mngK6u3QA42iV/Mo X-Google-Smtp-Source: ADKCNb5VJgzjv1bWJ/kmJeuQTeVT4kh3P3laUupPXzfNg3eA8rpnBE1GymWv7LLXDAyljQXE0modvg== X-Received: by 10.84.217.153 with SMTP id p25mr672329pli.213.1504736703790; Wed, 06 Sep 2017 15:25:03 -0700 (PDT) Received: from centos.eng.vmware.com ([208.91.1.34]) by smtp.gmail.com with ESMTPSA id o11sm769046pgp.88.2017.09.06.15.25.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Sep 2017 15:25:03 -0700 (PDT) From: Andy Zhou To: dev@openvswitch.org Date: Wed, 6 Sep 2017 15:24:07 -0700 Message-Id: <1504736647-15435-1-git-send-email-azhou@ovn.org> X-Mailer: git-send-email 1.8.3.1 X-Spam-Status: No, score=0.5 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM autolearn=disabled version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH] bridge: Fix controller status update to passive connections X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org The bug can cause ovs-vswitchd to crash (due to assert) when it is set up with a passive controller connection. Since only active connections are kept, the passive connection status update should be ignored and not trigger asserts. Reported-by: Josh Bailey Signed-off-by: Andy Zhou --- AUTHORS.rst | 1 + vswitchd/bridge.c | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/AUTHORS.rst b/AUTHORS.rst index cb0cd91b21ba..e304609b2b27 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -389,6 +389,7 @@ Ben Basler bbasler@nicira.com Bhargava Shastry bshastry@sec.t-labs.tu-berlin.de Bob Ball bob.ball@citrix.com Brad Hall brad@nicira.com +Brailey Josh josh@faucet.nz Brandon Heller brandonh@stanford.edu Brendan Kelley bkelley@nicira.com Brent Salisbury brent.salisbury@gmail.com diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index a8cbae78cb23..00f86182c820 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -2720,11 +2720,13 @@ refresh_controller_status(void) struct ofproto_controller_info *cinfo = shash_find_data(&info, cfg->target); - ovs_assert(cinfo); - ovsrec_controller_set_is_connected(cfg, cinfo->is_connected); - const char *role = ofp12_controller_role_to_str(cinfo->role); - ovsrec_controller_set_role(cfg, role); - ovsrec_controller_set_status(cfg, &cinfo->pairs); + /* cinfo is NULL when 'cfg->target' is a passive connection. */ + if (cinfo) { + ovsrec_controller_set_is_connected(cfg, cinfo->is_connected); + const char *role = ofp12_controller_role_to_str(cinfo->role); + ovsrec_controller_set_role(cfg, role); + ovsrec_controller_set_status(cfg, &cinfo->pairs); + } } ofproto_free_ofproto_controller_info(&info);