Message ID | 1503679232-11135-6-git-send-email-ian.stokes@intel.com |
---|---|
State | Changes Requested |
Headers | show |
Regards _Sugesh > -----Original Message----- > From: ovs-dev-bounces@openvswitch.org [mailto:ovs-dev- > bounces@openvswitch.org] On Behalf Of Ian Stokes > Sent: Friday, August 25, 2017 5:40 PM > To: dev@openvswitch.org > Subject: [ovs-dev] [RFC PATCH v2 05/10] flow: Modify minflow extract to > handle SPI. > > 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@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 */ [Sugesh] can we use the push_be64? > + } > + }else if (OVS_LIKELY(nw_proto == IPPROTO_SCTP)) { > if (OVS_LIKELY(size >= SCTP_HEADER_LEN)) { > const struct sctp_header *sctp = data; > > -- > 1.7.0.7 > > _______________________________________________ > dev mailing list > dev@openvswitch.org > https://mail.openvswitch.org/mailman/listinfo/ovs-dev
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@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.
> 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@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 will fix for rfc v3. > Thanks, > > Ben.
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;
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@intel.com> --- lib/flow.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-)