that is for this problem
[ovs-dev] [ovs-discuss] ovn: unsnat handling error for Distributed Gateway
https://mail.openvswitch.org/pipermail/ovs-dev/2017-April/330536.html

Previous patch
[PATCH] ovn-northd: Add logical flows to reply ICMP echo requests for all the other router ports connected to one switch

pls recheck, thks

在 2017/6/14 20:04, wei 写道:
ct(table=X,zone=X) will xlate 2 actions (ct and recirc), so they should be 
executed together.
---
  lib/dpif.c | 18 ++++++++++++++++--
  1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/lib/dpif.c b/lib/dpif.c
index fe6a986c5..72274731a 100644
--- a/lib/dpif.c
+++ b/lib/dpif.c
@@ -1109,6 +1109,7 @@ struct dpif_execute_helper_aux {
      const struct flow *flow;
      int error;
      const struct nlattr *meter_action; /* Non-NULL, if have a meter action. */
+    const struct nlattr *ct_action; /* stort ct action when it need to be 
execute together with recirc action. */
  };
/* This is called for actions that need the context of the datapath to be
@@ -1132,6 +1133,13 @@ dpif_execute_helper_cb(void *aux_, struct 
dp_packet_batch *packets_,
        break;
case OVS_ACTION_ATTR_CT:
+               if (nl_attr_type(nl_attr_next(action)) == 
OVS_ACTION_ATTR_RECIRC) {
+                   /* OVS_ACTION_ATTR_CT and the following 
OVS_ACTION_ATTR_RECIRC should execute together.
+                    * store first and execute in the next loop which process 
OVS_ACTION_ATTR_RECIRC). */
+                       aux->ct_action = action;
+                       break;
+               }
+
      case OVS_ACTION_ATTR_OUTPUT:
      case OVS_ACTION_ATTR_TUNNEL_PUSH:
      case OVS_ACTION_ATTR_TUNNEL_POP:
@@ -1142,7 +1150,7 @@ dpif_execute_helper_cb(void *aux_, struct dp_packet_batch 
*packets_,
          uint64_t stub[256 / 8];
          struct pkt_metadata *md = &packet->md;
- if (flow_tnl_dst_is_set(&md->tunnel) || aux->meter_action) {
+        if (flow_tnl_dst_is_set(&md->tunnel) || aux->meter_action || 
aux->ct_action) {
              ofpbuf_use_stub(&execute_actions, stub, sizeof stub);
if (aux->meter_action) {
@@ -1171,6 +1179,12 @@ dpif_execute_helper_cb(void *aux_, struct 
dp_packet_batch *packets_,
              if (md->tunnel.ip_dst) {
                  odp_put_tunnel_action(&md->tunnel, &execute_actions);
              }
+
+                       if (aux->ct_action) {
+                               /* current action definitely is 
OVS_ACTION_ATTR_RECIRC. */
+                               ofpbuf_put(&execute_actions, aux->ct_action, 
NLA_ALIGN(aux->ct_action->nla_len));
+                               aux->ct_action = NULL;
+                       }
              ofpbuf_put(&execute_actions, action, NLA_ALIGN(action->nla_len));
execute.actions = execute_actions.data;
@@ -1238,7 +1252,7 @@ dpif_execute_helper_cb(void *aux_, struct dp_packet_batch 
*packets_,
  static int
  dpif_execute_with_help(struct dpif *dpif, struct dpif_execute *execute)
  {
-    struct dpif_execute_helper_aux aux = {dpif, execute->flow, 0, NULL};
+    struct dpif_execute_helper_aux aux = {dpif, execute->flow, 0, NULL, NULL};
      struct dp_packet_batch pb;
COVERAGE_INC(dpif_execute_with_help);

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to