diff mbox series

[ovs-dev] ofp-actions: Fix userspace support for mpls_ttl

Message ID 5415d8b1a899016cf25e951d16f2ef2ee7f9ed3e.1600449575.git.tredaelli@redhat.com
State Accepted
Headers show
Series [ovs-dev] ofp-actions: Fix userspace support for mpls_ttl | expand

Commit Message

Timothy Redaelli Sept. 18, 2020, 5:19 p.m. UTC
Currently mpls_ttl is ignored when a flow is added because MFF_MPLS_TTL is
not handled in nx_put_raw().

This commit adds the correct handling of MFF_MPLS_TTL in nx_put_raw().

Fixes: bef3f465bcd5 ("openflow: Support matching and modifying MPLS TTL field.")
Cc: blp@ovn.org
Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
---
 lib/nx-match.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Ilya Maximets Sept. 23, 2020, 5:39 p.m. UTC | #1
On 9/18/20 7:19 PM, Timothy Redaelli wrote:
> Currently mpls_ttl is ignored when a flow is added because MFF_MPLS_TTL is
> not handled in nx_put_raw().
> 
> This commit adds the correct handling of MFF_MPLS_TTL in nx_put_raw().
> 
> Fixes: bef3f465bcd5 ("openflow: Support matching and modifying MPLS TTL field.")
> Cc: blp@ovn.org
> Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
> ---

Good catch, thanks!

The big issue is that we have almost no tests for these feature.
Could you, please, add some tests for this issue to tests/ovs-ofctl.at ?

It seems like we do not actually have tests for other mpls fields too,
but this might be addressed later.

Best regards, Ilya Maximets.

>  lib/nx-match.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/lib/nx-match.c b/lib/nx-match.c
> index 3ffd7d9d7..325a20ec6 100644
> --- a/lib/nx-match.c
> +++ b/lib/nx-match.c
> @@ -1133,6 +1133,11 @@ nx_put_raw(struct ofpbuf *b, enum ofp_version oxm, const struct match *match,
>                        mpls_lse_to_bos(flow->mpls_lse[0]));
>          }
>  
> +        if (match->wc.masks.mpls_lse[0] & htonl(MPLS_TTL_MASK)) {
> +            nxm_put_8(&ctx, MFF_MPLS_TTL, oxm,
> +                       mpls_lse_to_ttl(flow->mpls_lse[0]));
> +        }
> +
>          if (match->wc.masks.mpls_lse[0] & htonl(MPLS_LABEL_MASK)) {
>              nxm_put_32(&ctx, MFF_MPLS_LABEL, oxm,
>                         htonl(mpls_lse_to_label(flow->mpls_lse[0])));
>
Ilya Maximets Nov. 16, 2020, 7:27 p.m. UTC | #2
On 9/18/20 7:19 PM, Timothy Redaelli wrote:
> Currently mpls_ttl is ignored when a flow is added because MFF_MPLS_TTL is
> not handled in nx_put_raw().
> 
> This commit adds the correct handling of MFF_MPLS_TTL in nx_put_raw().
> 
> Fixes: bef3f465bcd5 ("openflow: Support matching and modifying MPLS TTL field.")
> Cc: blp@ovn.org
> Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
> ---

Thanks!

Applied to master and backported down to 2.6.



Best regards, Ilya Maximets.
diff mbox series

Patch

diff --git a/lib/nx-match.c b/lib/nx-match.c
index 3ffd7d9d7..325a20ec6 100644
--- a/lib/nx-match.c
+++ b/lib/nx-match.c
@@ -1133,6 +1133,11 @@  nx_put_raw(struct ofpbuf *b, enum ofp_version oxm, const struct match *match,
                       mpls_lse_to_bos(flow->mpls_lse[0]));
         }
 
+        if (match->wc.masks.mpls_lse[0] & htonl(MPLS_TTL_MASK)) {
+            nxm_put_8(&ctx, MFF_MPLS_TTL, oxm,
+                       mpls_lse_to_ttl(flow->mpls_lse[0]));
+        }
+
         if (match->wc.masks.mpls_lse[0] & htonl(MPLS_LABEL_MASK)) {
             nxm_put_32(&ctx, MFF_MPLS_LABEL, oxm,
                        htonl(mpls_lse_to_label(flow->mpls_lse[0])));