From patchwork Fri Jun 15 09:49:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 929838 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=fail (p=none dis=none) header.from=redhat.com 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 416bMx66jCz9s19 for ; Fri, 15 Jun 2018 19:50:53 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id C4346EEB; Fri, 15 Jun 2018 09:49:25 +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 17F67E41 for ; Fri, 15 Jun 2018 09:49:24 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-wr0-f179.google.com (mail-wr0-f179.google.com [209.85.128.179]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 874EF5A5 for ; Fri, 15 Jun 2018 09:49:23 +0000 (UTC) Received: by mail-wr0-f179.google.com with SMTP id f16-v6so9309800wrm.3 for ; Fri, 15 Jun 2018 02:49:23 -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:subject:date:message-id:in-reply-to :references; bh=7brWbhOnrgzmTSs4DM9Qw/B0dXSbRWtgC2/ejZmCY1c=; b=BzWAjUzuVomPjdUifd0g894NhkvRRAWGLWlyFgEbj9uh5kGzedxpymyBFaDcDLaNxs eTkkbYLcq9waV9lp4J8WoxWfQf0xPbZHPnwcODnrBgPF/RfustwJl/2rWqoOWJkuwpGx QjaKFp+gM/pyo4rZ2tRteu/hs9m5BdBKOEzDuEFeI8fgAVoQS928v0PNbf3AuL1HRgnC aBSox4UC+bb/++y2v1UBp4pctymc558Bl7HMsKrENr2GeK81ypqh9vU5ktzsza7/t2XN o+rLeOXSHZWNwvsD4g7puMzBm9ClbIkDv+PNPWlPqfoFamkL8x13kCXC69AoL36tb+gU DQtA== X-Gm-Message-State: APt69E3unbLDh4XyMEFOEeeaLVCxZut3T20fTCrJjiwYQbiqt+i7aPGr ZA2QkmCA/9nyV/+YUTtcMkO9/srKQBU= X-Google-Smtp-Source: ADUXVKKQuCnmocZxe3EEL+UG0Ik9Tz7Br2dWaqNf8A0AUC7AIwA+YchPVKWjauPemScYUY0Zspj98Q== X-Received: by 2002:a5d:4a4d:: with SMTP id v13-v6mr1017057wrs.91.1529056161982; Fri, 15 Jun 2018 02:49:21 -0700 (PDT) Received: from localhost.localdomain.com (nat-pool-mxp-t.redhat.com. [149.6.153.186]) by smtp.gmail.com with ESMTPSA id c53-v6sm17646770wrg.12.2018.06.15.02.49.21 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Jun 2018 02:49:21 -0700 (PDT) From: Lorenzo Bianconi To: dev@openvswitch.org Date: Fri, 15 Jun 2018 11:49:09 +0200 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE 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 3/3] OVN: add protocol unreachable support to OVN router ports 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 Add priority-70 flows to generate ICMP protocol unreachable messages in reply to packets directed to the router's IP address on IP protocols other than UDP, TCP, and ICMP Signed-off-by: Lorenzo Bianconi --- ovn/northd/ovn-northd.8.xml | 4 ---- ovn/northd/ovn-northd.c | 17 +++++++++++++++++ tests/ovn.at | 1 + 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/ovn/northd/ovn-northd.8.xml b/ovn/northd/ovn-northd.8.xml index 18a481b3d..cfd35115e 100644 --- a/ovn/northd/ovn-northd.8.xml +++ b/ovn/northd/ovn-northd.8.xml @@ -1342,10 +1342,6 @@ nd_na {

These flows should not match IP fragments with nonzero offset.

- -

- Details TBD. Not yet implemented. -

  • diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c index c4b04ae1c..0365eafb1 100644 --- a/ovn/northd/ovn-northd.c +++ b/ovn/northd/ovn-northd.c @@ -5179,6 +5179,23 @@ build_lrouter_flows(struct hmap *datapaths, struct hmap *ports, "next; };"); ovn_lflow_add(lflows, op->od, S_ROUTER_IN_IP_INPUT, 80, ds_cstr(&match), ds_cstr(&actions)); + + ds_clear(&match); + ds_clear(&actions); + + ds_put_format(&match, + "ip4 && ip4.dst == %s && !ip.later_frag", + op->lrp_networks.ipv4_addrs[i].addr_s); + ds_put_format(&actions, + "icmp4 {" + "eth.dst <-> eth.src; " + "ip4.dst <-> ip4.src; " + "ip.ttl = 255; " + "icmp4.type = 3; " + "icmp4.code = 2; " + "next; };"); + ovn_lflow_add(lflows, op->od, S_ROUTER_IN_IP_INPUT, 70, + ds_cstr(&match), ds_cstr(&actions)); } ds_clear(&match); diff --git a/tests/ovn.at b/tests/ovn.at index 4648a303c..6553d17c6 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -10444,6 +10444,7 @@ OVN_POPULATE_ARP ovn-nbctl --wait=hv sync test_ip_packet 1 1 000000000001 00000000ff01 $(ip_to_hex 192 168 1 1) $(ip_to_hex 192 168 1 254) 11 0000 7dae fcfc 0303 +test_ip_packet 1 1 000000000001 00000000ff01 $(ip_to_hex 192 168 1 1) $(ip_to_hex 192 168 1 254) 84 0000 7dae fcfd 0302 OVN_CHECK_PACKETS([hv1/vif1-tx.pcap], [vif1.expected]) test_tcp_syn_packet 2 2 000000000002 00000000ff02 $(ip_to_hex 192 168 2 1) $(ip_to_hex 192 168 2 254) 0000 8b40 3039 0000 7bae 4486