From patchwork Wed Jun 17 09:55:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 1311072 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=fail (p=none dis=none) header.from=redhat.com 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=Rnwnc46Z; dkim-atps=neutral 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 49n0nf4RTjz9sSg for ; Wed, 17 Jun 2020 19:56:04 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 759DF87962; Wed, 17 Jun 2020 09:56:01 +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 GANjzLRN_rxk; Wed, 17 Jun 2020 09:56:00 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 8D0FB87859; Wed, 17 Jun 2020 09:56:00 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 6EAE3C07FF; Wed, 17 Jun 2020 09:56:00 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 6D42AC016E for ; Wed, 17 Jun 2020 09:55:59 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 623D688671 for ; Wed, 17 Jun 2020 09:55:59 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TgjRKTkj+ziU for ; Wed, 17 Jun 2020 09:55:58 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by whitealder.osuosl.org (Postfix) with ESMTPS id 1EFC988624 for ; Wed, 17 Jun 2020 09:55:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592387756; 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; bh=VGl0/A4gn8TiwvmVOxyn2MsxcPWWK09BnTDrZlbrGho=; b=Rnwnc46ZtKM0c1dsB6jXwrBtiBSGd6PkV3ycMElEOhovG1qfqKTsWFnAWYrqMACsVbuQKL 48zBHGhnpLo564ZMaKCP94jhXn2rOm9+AiKopPWWLLN4H9w7n5EKaI4LyzxRh1oBIUMbQ4 WZMwjI8Jz7bJs/F7NGmrKfCMkNTtPw4= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-237-O1RBuYxuPLGPYib3FwcKqw-1; Wed, 17 Jun 2020 05:55:54 -0400 X-MC-Unique: O1RBuYxuPLGPYib3FwcKqw-1 Received: by mail-ej1-f72.google.com with SMTP id e14so776508ejt.16 for ; Wed, 17 Jun 2020 02:55:54 -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:mime-version :content-transfer-encoding; bh=VGl0/A4gn8TiwvmVOxyn2MsxcPWWK09BnTDrZlbrGho=; b=d/HlJpszHQ/6S2MSzMaYYLkMiwJ6f/6SvS2sqqc7rboOlkOLpQOnysfo74xk09tTuA fVtaWQhXwQc4U2Jtbg6wntrUSZWUYjGDYmKzxAk3T3dzfZykImfUwcXS4TjJqGLK55zS UkECTlZnCP52enUFmiuVV6NX2IjQwy2PxUTxk8uBxA/texxmeOv12oFBaWPIHaIU17tX w1MBXKpVmk+pJAmNqO+Ch12TnVZ5L5IpNvBHsNyXYibnrlvPIe1IkUDX+AQA1Zty38MV SSHWxcGR3iW5kTkqLnUNJ+0CCRVXOGhCIHs84EPfb367YFnJgQq52kvTTUOVTdke7oUn CzWQ== X-Gm-Message-State: AOAM533NP+VcZXffQu52JHaq8L2ztuIdruwYquCIfvgRy39lGiAWgiw3 xHHTf3AgTzrkjEYFiU3LWHYHf0s37YzjnJ+X4IqKXHDHGNErWqsbt6rzhclMrfhOqzW4tYn1vJZ D7+wtp4KDCFPAsFVk0g== X-Received: by 2002:a05:6402:b13:: with SMTP id bm19mr6663785edb.82.1592387752766; Wed, 17 Jun 2020 02:55:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJywNF7Q9XYV02EpC/zRatDZRGtU4UgstsFIu/D5e5EZWd21f8rrvDPlYRqYNcLU2T6NvFHkbQ== X-Received: by 2002:a05:6402:b13:: with SMTP id bm19mr6663765edb.82.1592387752503; Wed, 17 Jun 2020 02:55:52 -0700 (PDT) Received: from lore-desk.lan ([151.48.140.182]) by smtp.gmail.com with ESMTPSA id ce14sm13017083ejc.3.2020.06.17.02.55.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 02:55:51 -0700 (PDT) From: Lorenzo Bianconi To: ovs-dev@openvswitch.org Date: Wed, 17 Jun 2020 11:55:38 +0200 Message-Id: <35b6cdf4751c4ac5aebd2f018c859b794997970f.1592387613.git.lorenzo.bianconi@redhat.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn] northd: set packet length in check_pkt_larger() 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" Set packet length in lr_in_chk_pkt_len router pipeline instead of gw interface MTU since ovs kernel datapath usually works on L2 frames Fixes: 7d42c146be ("ovn: Generate ICMPv4 packet in router pipeline for larger packets") Signed-off-by: Lorenzo Bianconi --- northd/ovn-northd.c | 4 ++-- tests/ovn.at | 33 ++++++++++++++++++--------------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c index b8c9e9325..53d5bf245 100644 --- a/northd/ovn-northd.c +++ b/northd/ovn-northd.c @@ -10076,7 +10076,7 @@ build_lrouter_flows(struct hmap *datapaths, struct hmap *ports, ds_clear(&actions); ds_put_format(&actions, REGBIT_PKT_LARGER" = check_pkt_larger(%d);" - " next;", gw_mtu); + " next;", gw_mtu + 18); ovn_lflow_add_with_hint(lflows, od, S_ROUTER_IN_CHK_PKT_LEN, 50, ds_cstr(&match), ds_cstr(&actions), &od->l3dgw_port->nbrp->header_); @@ -10109,7 +10109,7 @@ build_lrouter_flows(struct hmap *datapaths, struct hmap *ports, "next(pipeline=ingress, table=0); };", rp->lrp_networks.ea_s, rp->lrp_networks.ipv4_addrs[0].addr_s, - gw_mtu - 18); + gw_mtu); ovn_lflow_add_with_hint(lflows, od, S_ROUTER_IN_LARGER_PKTS, 50, ds_cstr(&match), ds_cstr(&actions), &rp->nbrp->header_); diff --git a/tests/ovn.at b/tests/ovn.at index 7e1ace556..1801a3151 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -14801,14 +14801,16 @@ test_ip_packet_larger() { dst_mac="00000000ff01" # sw0-lr0 mac (internal router leg) src_ip=`ip_to_hex 10 0 0 3` dst_ip=`ip_to_hex 172 168 0 3` - # Set the packet length to 100. - pkt_len=0064 - packet=${dst_mac}${src_mac}08004500${pkt_len}0000000040010000 + # Set the packet length to 118. + pkt_len=0076 + packet=${dst_mac}${src_mac}08004500${pkt_len}000000004001c3d9 orig_packet_l3=${src_ip}${dst_ip}0304000000000000 orig_packet_l3=${orig_packet_l3}000000000000000000000000000000000000 orig_packet_l3=${orig_packet_l3}000000000000000000000000000000000000 orig_packet_l3=${orig_packet_l3}000000000000000000000000000000000000 orig_packet_l3=${orig_packet_l3}000000000000000000000000000000000000 + orig_packet_l3=${orig_packet_l3}000000000000000000000000000000000000 + packet=${packet}${orig_packet_l3} gw_ip_garp=ffffffffffff00002020121308060001080006040001000020201213aca80064000000000000aca80064 @@ -14818,32 +14820,33 @@ test_ip_packet_larger() { # localnet port. # If icmp_pmtu_reply_expected is 1, it means the packet is larger than # the gateway mtu and ovn-controller should drop the packet and instead - # generate ICMPv4 Destination Unreachable message with pmtu set to 42. + # generate ICMPv4 Destination Unreachable message with pmtu set to 100. if test $icmp_pmtu_reply_expected = 0; then # Packet to expect at br-phys. src_mac="000020201213" dst_mac="00000012af11" src_ip=`ip_to_hex 10 0 0 3` dst_ip=`ip_to_hex 172 168 0 3` - expected=${dst_mac}${src_mac}08004500${pkt_len}000000003f010100 + expected=${dst_mac}${src_mac}08004500${pkt_len}000000003f01c4d9 expected=${expected}${src_ip}${dst_ip}0304000000000000 expected=${expected}000000000000000000000000000000000000 expected=${expected}000000000000000000000000000000000000 expected=${expected}000000000000000000000000000000000000 expected=${expected}000000000000000000000000000000000000 + expected=${expected}000000000000000000000000000000000000 echo $expected > br_phys_n1.expected echo $gw_ip_garp >> br_phys_n1.expected else - # MTU would be 100 - 18 = 82 (hex 0052) - mtu=0052 + # MTU would be 118 - 18 = 100 (hex 0064) + mtu=0064 src_ip=`ip_to_hex 10 0 0 1` dst_ip=`ip_to_hex 10 0 0 3` - # pkt len should be 128 (28 (icmp packet) + 100 (orig ip + payload)) - reply_pkt_len=0080 - ip_csum=bd91 - icmp_reply=${src_mac}${dst_mac}08004500${reply_pkt_len}00004000fe016879 + # pkt len should be 146 (28 (icmp packet) + 118 (orig ip + payload)) + reply_pkt_len=0092 + ip_csum=f993 + icmp_reply=${src_mac}${dst_mac}08004500${reply_pkt_len}00004000fe016867 icmp_reply=${icmp_reply}${src_ip}${dst_ip}0304${ip_csum}0000${mtu} - icmp_reply=${icmp_reply}4500${pkt_len}000000003f010100 + icmp_reply=${icmp_reply}4500${pkt_len}000000003f01c4d9 icmp_reply=${icmp_reply}${orig_packet_l3} echo $icmp_reply > hv1-vif1.expected fi @@ -14883,12 +14886,12 @@ awk '{print $3}') ovn-sbctl create MAC_Binding ip=172.168.0.3 datapath=$dp_uuid \ logical_port=lr0-public mac="00\:00\:00\:12\:af\:11" -# Set the gateway mtu to 100. If the packet length is > 100, ovn-controller +# Set the gateway mtu to 100. If the packet length is > 118, ovn-controller # should send icmp host not reachable with pmtu set to 100. ovn-nbctl --wait=hv set logical_router_port lr0-public options:gateway_mtu=100 as hv3 ovs-appctl netdev-dummy/receive hv3-vif1 $arp_reply OVS_WAIT_UNTIL([ - test `as hv1 ovs-ofctl dump-flows br-int | grep "check_pkt_larger(100)" | \ + test `as hv1 ovs-ofctl dump-flows br-int | grep "check_pkt_larger(118)" | \ wc -l` -eq 1 ]) @@ -14899,7 +14902,7 @@ test_ip_packet_larger $icmp_reply_expected ovn-nbctl --wait=hv set logical_router_port lr0-public options:gateway_mtu=500 as hv3 ovs-appctl netdev-dummy/receive hv3-vif1 $arp_reply OVS_WAIT_UNTIL([ - test `as hv1 ovs-ofctl dump-flows br-int | grep "check_pkt_larger(500)" | \ + test `as hv1 ovs-ofctl dump-flows br-int | grep "check_pkt_larger(518)" | \ wc -l` -eq 1 ])