This is only used in one place and action processing can't change the
result, so only calculate it where it's needed.

Signed-off-by: Ben Pfaff <b...@nicira.com>
---
 ofproto/ofproto-dpif-xlate.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index 017ed06..3430a57 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -4786,7 +4786,6 @@ xlate_actions(struct xlate_in *xin, struct xlate_out 
*xout)
     struct xport *in_port;
     struct flow orig_flow;
     bool tnl_may_send;
-    bool is_icmp;
 
     COVERAGE_INC(xlate_actions);
 
@@ -4827,7 +4826,6 @@ xlate_actions(struct xlate_in *xin, struct xlate_out 
*xout)
             netflow_mask_wc(flow, ctx.wc);
         }
     }
-    is_icmp = is_icmpv4(flow) || is_icmpv6(flow);
 
     tnl_may_send = tnl_xlate_init(flow, xin->wc);
 
@@ -5098,7 +5096,7 @@ xlate_actions(struct xlate_in *xin, struct xlate_out 
*xout)
          * Avoid the problem here by making sure that only the low 8 bits of
          * either field can be unwildcarded for ICMP.
          */
-        if (is_icmp) {
+        if (is_icmpv4(flow) || is_icmpv6(flow)) {
             ctx.wc->masks.tp_src &= htons(UINT8_MAX);
             ctx.wc->masks.tp_dst &= htons(UINT8_MAX);
         }
-- 
2.1.3

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to