[ovs-dev] [RFC PATCH v2 05/10] flow: Modify minflow extract to handle SPI.

Ben Pfaff blp at ovn.org
Tue Oct 31 21:47:22 UTC 2017


On Fri, Aug 25, 2017 at 05:40:27PM +0100, Ian Stokes wrote:
> The patch modifies the miniflow extract function to hande the case where
> the network protocol for a packet is ESP. In this case the SPI value in
> the ESP header is extracted and set in the minflow map.
> 
> Signed-off-by: Ian Stokes <ian.stokes at intel.com>
> ---
>  lib/flow.c |   11 ++++++++++-
>  1 files changed, 10 insertions(+), 1 deletions(-)
> 
> diff --git a/lib/flow.c b/lib/flow.c
> index b2b10aa..428ff7a 100644
> --- a/lib/flow.c
> +++ b/lib/flow.c
> @@ -643,6 +643,7 @@ miniflow_extract(struct dp_packet *packet, struct miniflow *dst)
>      uint8_t nw_frag, nw_tos, nw_ttl, nw_proto;
>      uint8_t *ct_nw_proto_p = NULL;
>      ovs_be16 ct_tp_src = 0, ct_tp_dst = 0;
> +    ovs_be32 esp_spi = 0;
>  
>      /* Metadata. */
>      if (flow_tnl_dst_is_set(&md->tunnel)) {
> @@ -920,7 +921,15 @@ miniflow_extract(struct dp_packet *packet, struct miniflow *dst)
>                  miniflow_push_be16(mf, ct_tp_src, ct_tp_src);
>                  miniflow_push_be16(mf, ct_tp_dst, ct_tp_dst);
>              }
> -        } else if (OVS_LIKELY(nw_proto == IPPROTO_SCTP)) {
> +        } else if (OVS_LIKELY(nw_proto == IPPROTO_ESP)) {
> +            if (OVS_LIKELY(size >= ESP_HEADER_LEN)) {
> +                const struct esp_header *esp = data;
> +
> +                esp_spi = esp->spi;
> +                miniflow_push_be32(mf, spi, esp_spi);
> +                miniflow_push_be32(mf, pad4, 0); /* Pad for ESP */
> +            }
> +        }else if (OVS_LIKELY(nw_proto == IPPROTO_SCTP)) {
>              if (OVS_LIKELY(size >= SCTP_HEADER_LEN)) {
>                  const struct sctp_header *sctp = data;

This removes a space from the SCTP 'if' statement, it would be better
without that change.

Thanks,

Ben.


More information about the dev mailing list