From patchwork Mon Mar 4 22:35:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Pettit X-Patchwork-Id: 1051539 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=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org 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 44CwJl3DXFz9s3q for ; Tue, 5 Mar 2019 09:52:22 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id E8501EE7A; Mon, 4 Mar 2019 22:52:18 +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 AFC36ECEA for ; Mon, 4 Mar 2019 22:36:52 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay11.mail.gandi.net (relay11.mail.gandi.net [217.70.178.231]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 0F18780E for ; Mon, 4 Mar 2019 22:36:51 +0000 (UTC) Received: from localhost.localdomain (unknown [66.170.99.1]) (Authenticated sender: jpettit@ovn.org) by relay11.mail.gandi.net (Postfix) with ESMTPSA id 0DF8C100008 for ; Mon, 4 Mar 2019 22:36:49 +0000 (UTC) From: Justin Pettit To: dev@openvswitch.org Date: Mon, 4 Mar 2019 14:35:38 -0800 Message-Id: <20190304223538.125408-1-jpettit@ovn.org> X-Mailer: git-send-email 2.17.1 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH] ovn-nbctl: Don't segfault when ovn-northd doesn't configure dynamic addresses. 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 When ovn-nbctl is used to configure a logical switch port's addresses, it does a sanity-check to make sure that a duplicate address isn't being used. If a port is configured as "dynamic", ovn-northd is supposed to populate the "dynamic_addresses" column in the Logical_Switch_Port table. If it isn't ovn-nbctl, would dereference a null pointer as part of the duplicate address check. This patch checks that "dynamic_addresses" is actually set first. Signed-off-by: Justin Pettit Acked-by: Ben Pfaff Acked-by: Lucas Alvares Gomes --- ovn/utilities/ovn-nbctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c index 8a72e95741e2..2727b410a154 100644 --- a/ovn/utilities/ovn-nbctl.c +++ b/ovn/utilities/ovn-nbctl.c @@ -1489,7 +1489,7 @@ lsp_contains_duplicates(const struct nbrec_logical_switch *ls, for (size_t j = 0; j < lsp_test->n_addresses; j++) { struct lport_addresses laddrs_test; char *addr = lsp_test->addresses[j]; - if (is_dynamic_lsp_address(addr)) { + if (is_dynamic_lsp_address(addr) && lsp_test->dynamic_addresses) { addr = lsp_test->dynamic_addresses; } if (extract_lsp_addresses(addr, &laddrs_test)) {