Skip to content

Commit

Permalink
ofproto-dpif-xlate: Eliminate 'is_icmp' from xlate_actions().
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Jarno Rajahalme <[email protected]>
  • Loading branch information
blp committed Jul 31, 2015
1 parent 515793d commit 9d0b5cd
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions ofproto/ofproto-dpif-xlate.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 9d0b5cd

Please sign in to comment.