Acked-By: Miguel Angel Ajo <[email protected]>

On Tue, Apr 18, 2017 at 9:47 PM, Ben Pfaff <[email protected]> wrote:

> This will have a new user in an upcoming commit.
>
> Signed-off-by: Ben Pfaff <[email protected]>
> ---
>  lib/flow.c                   | 21 +++++++++++++++++++++
>  lib/flow.h                   |  1 +
>  ofproto/ofproto-dpif-xlate.c | 18 +-----------------
>  3 files changed, 23 insertions(+), 17 deletions(-)
>
> diff --git a/lib/flow.c b/lib/flow.c
> index 7552cd72a173..2ba51214ef80 100644
> --- a/lib/flow.c
> +++ b/lib/flow.c
> @@ -1024,6 +1024,27 @@ ct_state_from_string(const char *s)
>      return 0;
>  }
>
> +/* Clears the fields in 'flow' associated with connection tracking. */
> +void
> +flow_clear_conntrack(struct flow *flow)
> +{
> +    flow->ct_state = 0;
> +    flow->ct_zone = 0;
> +    flow->ct_mark = 0;
> +    flow->ct_label = OVS_U128_ZERO;
> +
> +    flow->ct_nw_proto = 0;
> +    flow->ct_tp_src = 0;
> +    flow->ct_tp_dst = 0;
> +    if (flow->dl_type == htons(ETH_TYPE_IP)) {
> +        flow->ct_nw_src = 0;
> +        flow->ct_nw_dst = 0;
> +    } else if (flow->dl_type == htons(ETH_TYPE_IPV6)) {
> +        memset(&flow->ct_ipv6_src, 0, sizeof flow->ct_ipv6_src);
> +        memset(&flow->ct_ipv6_dst, 0, sizeof flow->ct_ipv6_dst);
> +    }
> +}
> +
>  char *
>  flow_to_string(const struct flow *flow)
>  {
> diff --git a/lib/flow.h b/lib/flow.h
> index 9d4ae49ccfbd..2957108a68db 100644
> --- a/lib/flow.h
> +++ b/lib/flow.h
> @@ -74,6 +74,7 @@ void flow_get_metadata(const struct flow *, struct match
> *flow_metadata);
>
>  const char *ct_state_to_string(uint32_t state);
>  uint32_t ct_state_from_string(const char *);
> +void flow_clear_conntrack(struct flow *);
>
>  char *flow_to_string(const struct flow *);
>  void format_flags(struct ds *ds, const char *(*bit_to_string)(uint32_t),
> diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
> index a24aef9a43a1..76b8a3aa729a 100644
> --- a/ofproto/ofproto-dpif-xlate.c
> +++ b/ofproto/ofproto-dpif-xlate.c
> @@ -3222,23 +3222,7 @@ static void
>  clear_conntrack(struct xlate_ctx *ctx)
>  {
>      ctx->conntracked = false;
> -
> -    struct flow *flow = &ctx->xin->flow;
> -    flow->ct_state = 0;
> -    flow->ct_zone = 0;
> -    flow->ct_mark = 0;
> -    flow->ct_label = OVS_U128_ZERO;
> -
> -    flow->ct_nw_proto = 0;
> -    flow->ct_tp_src = 0;
> -    flow->ct_tp_dst = 0;
> -    if (flow->dl_type == htons(ETH_TYPE_IP)) {
> -        flow->ct_nw_src = 0;
> -        flow->ct_nw_dst = 0;
> -    } if (flow->dl_type == htons(ETH_TYPE_IPV6)) {
> -        memset(&flow->ct_ipv6_src, 0, sizeof flow->ct_ipv6_src);
> -        memset(&flow->ct_ipv6_dst, 0, sizeof flow->ct_ipv6_dst);
> -    }
> +    flow_clear_conntrack(&ctx->xin->flow);
>  }
>
>  static bool
> --
> 2.10.2
>
> _______________________________________________
> dev mailing list
> [email protected]
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to