[ovs-dev,RFC,2/3] OVN: add ovn-trace support to icmp4 action

Message ID 68aa692558686ea3eea10bc5c887aac80dcda367.1515606160.git.lorenzo.bianconi@redhat.com
State RFC
Headers show
Series
  • add acl reject rule support introducing icmp4 action
Related show

Commit Message

Lorenzo Bianconi Jan. 10, 2018, 5:59 p.m.
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
---
 ovn/utilities/ovn-trace.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

Comments

Ben Pfaff Jan. 23, 2018, 8:41 p.m. | #1
On Wed, Jan 10, 2018 at 06:59:00PM +0100, Lorenzo Bianconi wrote:
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

I recommend squashing this into patch 1.

I'd use "icmp4" as the node name, instead of "icmp", for clarity.

Thanks a lot!

Patch

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;
         }
 
     }