From patchwork Fri Dec 6 20:13:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell Bryant X-Patchwork-Id: 1205276 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.137; helo=fraxinus.osuosl.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 fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47V3gy5WSbz9sPf for ; Sat, 7 Dec 2019 07:13:50 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id AB51987845; Fri, 6 Dec 2019 20:13:48 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9T7xMmfOJJNo; Fri, 6 Dec 2019 20:13:48 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id F27A58739A; Fri, 6 Dec 2019 20:13:47 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id CE6FBC1D7D; Fri, 6 Dec 2019 20:13:47 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id A63A5C077D for ; Fri, 6 Dec 2019 20:13:46 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 9A3C188A18 for ; Fri, 6 Dec 2019 20:13:46 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RMgzT2Ab+bJf for ; Fri, 6 Dec 2019 20:13:45 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by hemlock.osuosl.org (Postfix) with ESMTPS id 52287889CE for ; Fri, 6 Dec 2019 20:13:45 +0000 (UTC) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-219-D4nx6ZRNOKOyzogg1Kk3bA-1; Fri, 06 Dec 2019 15:13:42 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C2432DBB0; Fri, 6 Dec 2019 20:13:41 +0000 (UTC) Received: from t480s.redhat.com (ovpn-121-23.rdu2.redhat.com [10.10.121.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1FEF97C804; Fri, 6 Dec 2019 20:13:40 +0000 (UTC) From: Russell Bryant To: dev@openvswitch.org Date: Fri, 6 Dec 2019 15:13:39 -0500 Message-Id: <20191206201339.248021-1-russell@ovn.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: D4nx6ZRNOKOyzogg1Kk3bA-1 X-Mimecast-Spam-Score: 0 Subject: [ovs-dev] [PATCH ovn v1] nbctl: Log the source of duplicate IP addresses X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" When doing an lsp-add, ovn-nbctl will ensure that there is not another port on the same logical switch with the same IP address. I'm seeing this error occur with ovn-kubernetes, and I would find it helpful to see which port it thinks had the duplicate address, because it's not obvious what's happening. Signed-off-by: Russell Bryant Acked-by: Han Zhou --- utilities/ovn-nbctl.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/utilities/ovn-nbctl.c b/utilities/ovn-nbctl.c index 8188948fa..46ba3a938 100644 --- a/utilities/ovn-nbctl.c +++ b/utilities/ovn-nbctl.c @@ -1506,13 +1506,16 @@ nbctl_lsp_get_tag(struct ctl_context *ctx) static char * lsp_contains_duplicate_ip(struct lport_addresses *laddrs1, - struct lport_addresses *laddrs2) + struct lport_addresses *laddrs2, + const struct nbrec_logical_switch_port *lsp_test) { for (size_t i = 0; i < laddrs1->n_ipv4_addrs; i++) { for (size_t j = 0; j < laddrs2->n_ipv4_addrs; j++) { if (laddrs1->ipv4_addrs[i].addr == laddrs2->ipv4_addrs[j].addr) { - return xasprintf("duplicate IPv4 address %s", - laddrs1->ipv4_addrs[i].addr_s); + return xasprintf("duplicate IPv4 address '%s' found on " + "logical switch port '%s'", + laddrs1->ipv4_addrs[i].addr_s, + lsp_test->name); } } } @@ -1521,8 +1524,10 @@ lsp_contains_duplicate_ip(struct lport_addresses *laddrs1, for (size_t j = 0; j < laddrs2->n_ipv6_addrs; j++) { if (IN6_ARE_ADDR_EQUAL(&laddrs1->ipv6_addrs[i].addr, &laddrs2->ipv6_addrs[j].addr)) { - return xasprintf("duplicate IPv6 address %s", - laddrs1->ipv6_addrs[i].addr_s); + return xasprintf("duplicate IPv6 address '%s' found on " + "logical switch port '%s'", + laddrs1->ipv6_addrs[i].addr_s, + lsp_test->name); } } } @@ -1553,7 +1558,8 @@ lsp_contains_duplicates(const struct nbrec_logical_switch *ls, addr = lsp_test->dynamic_addresses; } if (extract_lsp_addresses(addr, &laddrs_test)) { - sub_error = lsp_contains_duplicate_ip(&laddrs, &laddrs_test); + sub_error = lsp_contains_duplicate_ip(&laddrs, &laddrs_test, + lsp_test); destroy_lport_addresses(&laddrs_test); if (sub_error) { goto err_out;