From patchwork Sat Apr 6 10:32:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 1920387 X-Patchwork-Delegate: dceara@redhat.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=AcOheAE5; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VBWrm4WwSz1yYf for ; Sat, 6 Apr 2024 21:32:40 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 80B6A82778; Sat, 6 Apr 2024 10:32:34 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id Hoh9Mm1uOJNI; Sat, 6 Apr 2024 10:32:33 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.9.56; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 41A118210F Authentication-Results: smtp1.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=AcOheAE5 Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp1.osuosl.org (Postfix) with ESMTPS id 41A118210F; Sat, 6 Apr 2024 10:32:33 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 13A71C0077; Sat, 6 Apr 2024 10:32:33 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id D0A20C0037 for ; Sat, 6 Apr 2024 10:32:31 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id BF2C440413 for ; Sat, 6 Apr 2024 10:32:31 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 2SX1JhAlycDy for ; Sat, 6 Apr 2024 10:32:30 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=170.10.129.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=lorenzo.bianconi@redhat.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp2.osuosl.org 3DFEF400FB Authentication-Results: smtp2.osuosl.org; dmarc=pass (p=none dis=none) header.from=redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 3DFEF400FB Authentication-Results: smtp2.osuosl.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=AcOheAE5 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp2.osuosl.org (Postfix) with ESMTPS id 3DFEF400FB for ; Sat, 6 Apr 2024 10:32:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712399548; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/X1tzxxn4rBHy6aIHghZMC4jL14Ok5ZNl20H4pT8eFw=; b=AcOheAE5jxHhuIVxRW0XmIPakczAjLYBRC7DpOSSvktQPL/Eh1NsWIdB4wROaP63IxPs8f cXwvrE9XKB6HJGhI+4SFhpse7SIEVcbCeL6u9v2Dkcmvin6cwBnbKNcYkL05h0mCvXxVOz NiTWyL7VYTDhJmdYm7kj7QAZm2K8o4k= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-5-HQ69p9eRNLKRBoTvKf3deA-1; Sat, 06 Apr 2024 06:32:26 -0400 X-MC-Unique: HQ69p9eRNLKRBoTvKf3deA-1 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-343efa26688so747011f8f.3 for ; Sat, 06 Apr 2024 03:32:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712399545; x=1713004345; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=/X1tzxxn4rBHy6aIHghZMC4jL14Ok5ZNl20H4pT8eFw=; b=YmrLwBBaEsLJzjBueMQm5sTtDEx6H76glXAffuSgv63qrv4CXuLkF+bjp4e1JKvFCm n+DpR6rgVwaDgZiMrTySHfG+RDNnDh4WqiUDpe+Cry93eWksPYV3jWsMY+vQGe6wrLiW MFFF5yCifLO9GQoJxCt5qh4Qt9gCa+vIn99pEGcpe29aoHOzlWagXdBBC/MddEeSrYhv tHSDi/+rkV/qe6hBg72PtYTo++XGvZN5ZjOcD7yIVru5uvyCxzOEGSk6meQgC4aCnNze gJf6dzWl3BdvcIngSGxCNmzJas2TN5R25cCdCMxlBFMXyUotZnNN0D+Lj7EBrtYsYzu9 VR2Q== X-Gm-Message-State: AOJu0YyfElHQgg2drVXTBQZtQVDgIZhpbQPtGeVSmlXyETIyTARForSf zajC8kYUN5D6Qk+Avzf+JcuCU56iec7V+FuXnbeOfND6Tge/Szvza9b88g+uFPOcgRxwefwnUJg 1iqBZBqmbSVmxC56+ntwc4f919+x4BuNTy7k97DB68U7Mjg/wgNeUNqsiEcv+T9iFA3g6ynf5o4 HZWO1pCQrKFtbbIiCVDTOYMJcVyZC4pPZhftVzP5vsaLDGu1jYBg== X-Received: by 2002:adf:ab01:0:b0:343:826a:7a36 with SMTP id q1-20020adfab01000000b00343826a7a36mr2671001wrc.58.1712399545404; Sat, 06 Apr 2024 03:32:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFwmfxs2BY6byLfAb9qoz+PzQqwIDJT/vuIVviN4FCRNWFNiPwMPfGyAlwdvDFXZl8AGL3YfQ== X-Received: by 2002:adf:ab01:0:b0:343:826a:7a36 with SMTP id q1-20020adfab01000000b00343826a7a36mr2670986wrc.58.1712399544844; Sat, 06 Apr 2024 03:32:24 -0700 (PDT) Received: from localhost (net-93-151-202-124.cust.dsl.teletu.it. [93.151.202.124]) by smtp.gmail.com with ESMTPSA id e8-20020a5d4e88000000b003438cc1d2b4sm4167890wru.59.2024.04.06.03.32.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Apr 2024 03:32:24 -0700 (PDT) From: Lorenzo Bianconi To: ovs-dev@openvswitch.org Date: Sat, 6 Apr 2024 12:32:21 +0200 Message-ID: <1c1360b80d91b46babe5c1d66f77254a55abf6fa.1712398898.git.lorenzo.bianconi@redhat.com> X-Mailer: git-send-email 2.44.0 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn] northd: Fix BFD for policy routing. 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" Fix the following ovn-controller error when bfd policy routing has just one available next-hop. lflow|WARN|error parsing actions "reg8[0..15] = 1; reg8[16..31] = select(1);": Syntax error at `;' expecting at least 2 group members. Fixes: 62d5491c0155 ("northd: Add BFD support for ECMP route policy.") Reported-at: https://issues.redhat.com/browse/FDP-543 Signed-off-by: Lorenzo Bianconi Acked-by: Mark Michelson --- northd/northd.c | 29 ++++++++++++++++++++--------- tests/system-ovn.at | 13 +++++++++---- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/northd/northd.c b/northd/northd.c index 02cf5b234..5b6bd90c8 100644 --- a/northd/northd.c +++ b/northd/northd.c @@ -10087,19 +10087,30 @@ build_ecmp_routing_policy_flows(struct lflow_table *lflows, lflow_ref); } + if (!n_valid_nexthops) { + goto cleanup; + } + ds_clear(&actions); - ds_put_format(&actions, "%s = %"PRIu16 - "; %s = select(", REG_ECMP_GROUP_ID, ecmp_group_id, - REG_ECMP_MEMBER_ID); + if (n_valid_nexthops > 1) { + ds_put_format(&actions, "%s = %"PRIu16 + "; %s = select(", REG_ECMP_GROUP_ID, ecmp_group_id, + REG_ECMP_MEMBER_ID); + + for (size_t i = 0; i < n_valid_nexthops; i++) { + if (i > 0) { + ds_put_cstr(&actions, ", "); + } - for (size_t i = 0; i < n_valid_nexthops; i++) { - if (i > 0) { - ds_put_cstr(&actions, ", "); + ds_put_format(&actions, "%"PRIuSIZE, valid_nexthops[i]); } - - ds_put_format(&actions, "%"PRIuSIZE, valid_nexthops[i]); + ds_put_cstr(&actions, ");"); + } else { + ds_put_format(&actions, "%s = %"PRIu16 + "; %s = %"PRIuSIZE"; next;", REG_ECMP_GROUP_ID, + ecmp_group_id, REG_ECMP_MEMBER_ID, + valid_nexthops[0]); } - ds_put_cstr(&actions, ");"); ovn_lflow_add_with_hint(lflows, od, S_ROUTER_IN_POLICY, rule->priority, rule->match, ds_cstr(&actions), &rule->header_, diff --git a/tests/system-ovn.at b/tests/system-ovn.at index c699f7960..085edd81d 100644 --- a/tests/system-ovn.at +++ b/tests/system-ovn.at @@ -6834,12 +6834,13 @@ check ovn-nbctl clear logical_router_static_route $route_uuid bfd wait_column "admin_down" nb:bfd status logical_port=rp-public OVS_WAIT_UNTIL([ip netns exec server bfdd-control status | grep -qi state=Down]) -check ovn-nbctl --bfd lr-policy-add R1 100 "ip4.src == 200.0.0.0/8" reroute 172.16.1.50 -wait_column "up" nb:bfd status logical_port=rp-public -OVS_WAIT_UNTIL([ovn-sbctl dump-flows R1 |grep lr_in_policy |grep 'ip4.src == 200.0.0.0/8' |grep -q 172.16.1.50]) +check ovn-nbctl --bfd lr-policy-add R1 100 "ip4.src == 200.0.0.0/8" reroute 172.16.1.50,172.16.1.60 +wait_column "up" nb:bfd status dst_ip=172.16.1.50 +OVS_WAIT_UNTIL([ovn-sbctl dump-flows R1 |grep lr_in_policy_ecmp |grep -q 172.16.1.50]) check ovn-nbctl lr-policy-del R1 -wait_column "admin_down" nb:bfd status logical_port=rp-public +wait_column "admin_down" nb:bfd status dst_ip=172.16.1.50 +wait_column "admin_down" nb:bfd status dst_ip=172.16.1.60 OVS_WAIT_UNTIL([ip netns exec server bfdd-control status | grep -qi state=Down]) NETNS_START_TCPDUMP([server], [-nni s1 udp port 3784 -Q in], [bfd]) @@ -6847,6 +6848,10 @@ sleep 5 kill $(pidof tcpdump) AT_CHECK([grep -qi bfd bfd.tcpdump],[1]) +uuid=$(fetch_column nb:bfd _uuid dst_ip="172.16.1.60") +check ovn-nbctl destroy bfd $uuid +uuid=$(fetch_column nb:bfd _uuid logical_port="rp-public") + # restart the connection check ovn-nbctl set logical_router_static_route $route_uuid bfd=$uuid check ovn-nbctl --bfd lr-policy-add R1 100 "ip4.src == 200.0.0.0/8" reroute 172.16.1.50