From patchwork Wed Jan 10 17:59:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 858456 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=) 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 3zGxcq69c1z9ryQ for ; Thu, 11 Jan 2018 05:00:27 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 64E3EFF4; Wed, 10 Jan 2018 17:59:27 +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 235D8FE9 for ; Wed, 10 Jan 2018 17:59:26 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 9621214E for ; Wed, 10 Jan 2018 17:59:25 +0000 (UTC) Received: by mail-wm0-f68.google.com with SMTP id 143so600495wma.5 for ; Wed, 10 Jan 2018 09:59:25 -0800 (PST) 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=FZGI4MKqzN+Dbf98JLcefmWNzXOwCJ3NHkG/Hljam/o=; b=VfAaph/nzvhOTG/OBkL+p9TvI05OJU1kun7EI//AlW3zq/UirHnPH/CzSCY1B9284k fpcgnv0verM5eeLrHZJZ8vODTc2chaJPcHsIHBK2VklFv2PfTvhSDNx6KJzWyQ/q+CFT SCgypzbRuzvmGFQhHBW+IbPorlMS/3JTQNLDx6kcJJ6A1ro7CjCkb0vuabJKUzBhs3J6 WzdeO1TS2LmDiyCds0JxvHK2a0vhMvpKoVeKRk6JK+tljeJwmVmEYO0gvRnIwMdgiFHU +j8IwDq+uCkHV37+C/JaoHbglbPfOPvVq8mpiNCxAZKV1trUqNuqrAj5JgSezuVVmPJL kC9Q== X-Gm-Message-State: AKGB3mJUm9pUuwHCxhr/o12yBuClPQwjfTwEc+hem8aZaoIVYvPFr6J9 u+aBdb7NJaoM6uHOx5wtlOytgH1fUZY= X-Google-Smtp-Source: ACJfBovngrMBMh3tT4FxupT+iyGPF6puT6wXA/ZxCZp+Y1eWQSjnyBWB+FePL26Mv/xlRGHwcr+NdA== X-Received: by 10.28.232.81 with SMTP id f78mr17069765wmh.31.1515607164066; Wed, 10 Jan 2018 09:59:24 -0800 (PST) Received: from localhost.localdomain.com (nat-pool-mxp-t.redhat.com. [149.6.153.186]) by smtp.gmail.com with ESMTPSA id 187sm23591636wmu.19.2018.01.10.09.59.23 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Jan 2018 09:59:23 -0800 (PST) From: Lorenzo Bianconi To: dev@openvswitch.org Date: Wed, 10 Jan 2018 18:59:00 +0100 Message-Id: <68aa692558686ea3eea10bc5c887aac80dcda367.1515606160.git.lorenzo.bianconi@redhat.com> X-Mailer: git-send-email 2.13.6 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] [RFC 2/3] OVN: add ovn-trace support to icmp4 action 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 Signed-off-by: Lorenzo Bianconi --- ovn/utilities/ovn-trace.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/ovn/utilities/ovn-trace.c b/ovn/utilities/ovn-trace.c index 7ff4a2682..8f44a852d 100644 --- a/ovn/utilities/ovn-trace.c +++ b/ovn/utilities/ovn-trace.c @@ -1535,6 +1535,29 @@ execute_nd_ns(const struct ovnact_nest *on, const struct ovntrace_datapath *dp, } static void +execute_icmp(const struct ovnact_nest *on, const struct ovntrace_datapath *dp, + const struct flow *uflow, uint8_t table_id, + enum ovnact_pipeline pipeline, struct ovs_list *super) +{ + struct flow icmp_flow = *uflow; + + /* Update fields for ICMP. */ + icmp_flow.dl_dst = uflow->dl_dst; + icmp_flow.dl_src = uflow->dl_src; + icmp_flow.nw_dst = uflow->nw_dst; + icmp_flow.nw_src = uflow->nw_src; + icmp_flow.nw_proto = 1; + icmp_flow.tp_src = htons(3); /* icmp type */ + icmp_flow.tp_dst = htons(1); /* icmp code */ + + struct ovntrace_node *node = ovntrace_node_append( + super, OVNTRACE_NODE_TRANSFORMATION, "icmp"); + + trace_actions(on->nested, on->nested_len, dp, &icmp_flow, + table_id, pipeline, &node->subs); +} + +static void execute_get_mac_bind(const struct ovnact_get_mac_bind *bind, const struct ovntrace_datapath *dp, struct flow *uflow, struct ovs_list *super) @@ -1888,6 +1911,11 @@ trace_actions(const struct ovnact *ovnacts, size_t ovnacts_len, case OVNACT_LOG: execute_log(ovnact_get_LOG(a), uflow, super); break; + + case OVNACT_ICMP: + execute_icmp(ovnact_get_ICMP(a), dp, uflow, table_id, pipeline, + super); + break; } }