From patchwork Fri Jun 11 14:31:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 1490983 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=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: 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=CDuxllQe; dkim-atps=neutral Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4G1jwh2fjrz9sVb for ; Sat, 12 Jun 2021 00:32:20 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id D32FD60AC3; Fri, 11 Jun 2021 14:32:17 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HYqfhqUI2rOH; Fri, 11 Jun 2021 14:32:17 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id 233E0606B8; Fri, 11 Jun 2021 14:32:16 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 04B0DC000F; Fri, 11 Jun 2021 14:32:16 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 047ABC000D for ; Fri, 11 Jun 2021 14:32:14 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id D834383E0E for ; Fri, 11 Jun 2021 14:32:12 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp1.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=redhat.com Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id iGR7hRqWriix for ; Fri, 11 Jun 2021 14:32:11 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp1.osuosl.org (Postfix) with ESMTPS id A6A0F83E1C for ; Fri, 11 Jun 2021 14:32:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623421930; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+vnfx6ulU+uYMqQAs1PH1Akoe/Ay5HadHoPy6c9bQQ0=; b=CDuxllQeX78u6QLuKZOeCG12B5k95P4LdhP1TBlHqEEb86CQMnGpEh/klnf/jp+RBstPef sQvvtigpuZN3j8CUuTFhPPzvgrrLx0ycb8ClaX5WJkn/I47w6Bl3f84Z+JGO/Ia12b0W8d FMmidbapfxu8JiIIr0WdhG38Sr72XCE= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-120-Y27u057-PLOE4Q8SS_eZZA-1; Fri, 11 Jun 2021 10:32:03 -0400 X-MC-Unique: Y27u057-PLOE4Q8SS_eZZA-1 Received: by mail-ed1-f69.google.com with SMTP id ch5-20020a0564021bc5b029039389929f28so8175292edb.16 for ; Fri, 11 Jun 2021 07:32:03 -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:in-reply-to :references:mime-version:content-transfer-encoding; bh=+vnfx6ulU+uYMqQAs1PH1Akoe/Ay5HadHoPy6c9bQQ0=; b=A+cjkMK4F0OaxsACrmSDD4Frw5FHrF6V9gp7GxHlwntiWkxl3CEtnkOdS/akSkap+e 6ZEU6I824XLEnmKxGJyvg3mq4HgDLOQjzVxWKTkQJtv5cmt2npxJsDQdm9+1hgaMMgz0 c/AGjCRJFVoiUDGivZkQ7KB+bCm7oyAf7o/I7Jz9DADjgcCxIa/PTbWYwq0T/nlNlYZM XzB0urvi+wyvWtxCPBVZdmIbnUPUxBca3f+bt+MQrx4kWbSyf1z9BN9sge3iku4P0UmS qgpudWl8aI43hEvCbiLtlDCpVLLz1aOt87wnmNo5fZer4GQMYWq4bxgqprTDMildevrw fQpQ== X-Gm-Message-State: AOAM532h2cTFwBHONAx2geqzwYlVgCNWOeaCnbk0+I5w+jlYxvtjh+ap BT8ztDkEAI3EPVu7VM3qwtglTpXnSoKJn/rxVDFgikHYl+hMRexUozVvzk40U+dUSO0CCgkKmbn ezV2P9dGzS/hh418HzJnYxeoXiNWK5VyewARpzJZ1HjsUrfd3N+xSTy/SxlWd1GWwbI9L/VQsKC MfWzPY X-Received: by 2002:aa7:dd1a:: with SMTP id i26mr4079900edv.358.1623421922088; Fri, 11 Jun 2021 07:32:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwG2C1by6Pu0kpre3gYxbt8fzfHDgqHz5N7Ud1ReH28SjuRc2epi7eTgJ9jRtfuWbdEfkoqlw== X-Received: by 2002:aa7:dd1a:: with SMTP id i26mr4079870edv.358.1623421921830; Fri, 11 Jun 2021 07:32:01 -0700 (PDT) Received: from lore-desk.redhat.com (net-47-53-237-43.cust.vodafonedsl.it. [47.53.237.43]) by smtp.gmail.com with ESMTPSA id d5sm2721586edt.49.2021.06.11.07.32.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Jun 2021 07:32:01 -0700 (PDT) From: Lorenzo Bianconi To: ovs-dev@openvswitch.org Date: Fri, 11 Jun 2021 16:31:54 +0200 Message-Id: <2280175bfbb0f010c0c6d3b850aba9c8ff8d9c2b.1623420545.git.lorenzo.bianconi@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=lorenzo.bianconi@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH v3 2/3] northd: enable check_pkt_larger for gw router 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" As it is already done for distributed gw router scenario, introduce check_pkt_larger logical flows for gw router use case. Signed-off-by: Lorenzo Bianconi --- northd/ovn-northd.c | 31 +++++++++++++++++++++--------- tests/ovn.at | 47 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 9 deletions(-) diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c index 512ec4a32..23367dbb0 100644 --- a/northd/ovn-northd.c +++ b/northd/ovn-northd.c @@ -10534,17 +10534,30 @@ build_check_pkt_len_flows_for_lrouter( struct hmap *ports, struct ds *match, struct ds *actions) { - if (od->nbr) { + if (!od->nbr) { + return; + } - /* Packets are allowed by default. */ - ovn_lflow_add(lflows, od, S_ROUTER_IN_CHK_PKT_LEN, 0, "1", - "next;"); - ovn_lflow_add(lflows, od, S_ROUTER_IN_LARGER_PKTS, 0, "1", - "next;"); + /* Packets are allowed by default. */ + ovn_lflow_add(lflows, od, S_ROUTER_IN_CHK_PKT_LEN, 0, "1", + "next;"); + ovn_lflow_add(lflows, od, S_ROUTER_IN_LARGER_PKTS, 0, "1", + "next;"); - if (od->l3dgw_port && od->l3redirect_port) { - build_check_pkt_len_flows_for_lrp(od->l3dgw_port, lflows, - ports, match, actions); + if (od->l3dgw_port && od->l3redirect_port) { + /* gw router port */ + build_check_pkt_len_flows_for_lrp(od->l3dgw_port, lflows, + ports, match, actions); + } else if (smap_get(&od->nbr->options, "chassis")) { + for (size_t i = 0; i < od->nbr->n_ports; i++) { + /* gw router */ + struct ovn_port *rp = ovn_port_find(ports, + od->nbr->ports[i]->name); + if (!rp) { + continue; + } + build_check_pkt_len_flows_for_lrp(rp, lflows, ports, match, + actions); } } } diff --git a/tests/ovn.at b/tests/ovn.at index 11a85c457..5c3ed2633 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -16408,6 +16408,53 @@ for mtu in 100 500 118; do test_ip6_packet_larger $mtu done +ovn-nbctl lsp-del sw0-lr0 + +ovn-nbctl lr-del lr0 +ovn-nbctl create Logical_Router name=lr1 options:chassis="hv1" +ovn-nbctl lrp-add lr1 lr1-sw0 00:00:00:00:ff:01 10.0.0.1/24 1000::1/64 +ovn-nbctl lsp-add sw0 sw0-lr1 +ovn-nbctl lsp-set-type sw0-lr1 router +ovn-nbctl lsp-set-addresses sw0-lr1 router +ovn-nbctl lsp-set-options sw0-lr1 router-port=lr1-sw0 + +ovn-nbctl lrp-add lr1 lr1-public 00:00:20:20:12:13 172.168.0.100/24 2000::1/64 +ovn-nbctl lsp-del public-lr0 +ovn-nbctl lsp-add public public-lr1 +ovn-nbctl lsp-set-type public-lr1 router +ovn-nbctl lsp-set-addresses public-lr1 router +ovn-nbctl lsp-set-options public-lr1 router-port=lr1-public + +ovn-nbctl lr-nat-add lr1 snat 172.168.0.100 10.0.0.0/24 +ovn-nbctl lr-nat-add lr1 snat 2000::1 1000::/64 + +dp_uuid=$(ovn-sbctl find datapath_binding | grep sw0 -B2 | grep _uuid | \ +awk '{print $3}') +ovn-sbctl create MAC_Binding ip=172.168.0.3 datapath=$dp_uuid \ +logical_port=lr1-public mac="00\:00\:00\:12\:af\:11" + +# Try different gateway mtus and send a 142-byte packet (corresponding +# to a 124-byte MTU). If the MTU is less than 124, ovn-controller +# should send icmp host not reachable with pmtu set to $mtu. +for mtu in 100 500 118; do + AS_BOX([testing gw mtu $mtu]) + check ovn-nbctl --wait=hv set logical_router_port lr1-public options:gateway_mtu=$mtu + ovn-sbctl dump-flows > sbflows-gw-$mtu + AT_CAPTURE_FILE([sbflows-gw-$mtu]) + + OVS_WAIT_FOR_OUTPUT([ + as hv1 ovs-ofctl dump-flows br-int > br-int-gw-flows-$mtu + AT_CAPTURE_FILE([br-int-gw-flows-$mtu]) + grep "check_pkt_larger($(expr $mtu + 18))" br-int-gw-flows-$mtu | wc -l], [0], [1 +]) + + AS_BOX([testing gw mtu $mtu - IPv4]) + test_ip_packet_larger $mtu + + AS_BOX([testing gw mtu $mtu - IPv6]) + test_ip6_packet_larger $mtu +done + OVN_CLEANUP([hv1]) AT_CLEANUP ])