[ovs-dev,2/3] odp-util: Avoid revalidation error for masked NSH set action.

Message ID 20181215021655.29228-2-blp@ovn.org
State Accepted
Headers show
Series
  • [ovs-dev,1/3] Fix bugs in L3 protocol support.
Related show

Commit Message

Ben Pfaff Dec. 15, 2018, 2:16 a.m.
A masked NSH set action has mdtype 0 because the mdtype is not being
changed, but odp_nsh_key_from_attr() rejects this because mdtype 0 does
not match up with the OVS_NSH_KEY_ATTR_MD1 attribute being present.  This
fixes the problem.

The kernel datapath in flow_netlink function nsh_key_put_from_nlattr() has
a similar exception.

Signed-off-by: Ben Pfaff <blp@ovn.org>
---
 lib/odp-util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Justin Pettit Jan. 17, 2019, 10:05 p.m. | #1
> On Dec 14, 2018, at 6:16 PM, Ben Pfaff <blp@ovn.org> wrote:
> 
> A masked NSH set action has mdtype 0 because the mdtype is not being
> changed, but odp_nsh_key_from_attr() rejects this because mdtype 0 does
> not match up with the OVS_NSH_KEY_ATTR_MD1 attribute being present.  This
> fixes the problem.
> 
> The kernel datapath in flow_netlink function nsh_key_put_from_nlattr() has
> a similar exception.
> 
> Signed-off-by: Ben Pfaff <blp@ovn.org>

Acked-by: Justin Pettit <jpettit@ovn.org>
Ben Pfaff Jan. 18, 2019, 10:19 p.m. | #2
On Thu, Jan 17, 2019 at 02:05:48PM -0800, Justin Pettit wrote:
> 
> > On Dec 14, 2018, at 6:16 PM, Ben Pfaff <blp@ovn.org> wrote:
> > 
> > A masked NSH set action has mdtype 0 because the mdtype is not being
> > changed, but odp_nsh_key_from_attr() rejects this because mdtype 0 does
> > not match up with the OVS_NSH_KEY_ATTR_MD1 attribute being present.  This
> > fixes the problem.
> > 
> > The kernel datapath in flow_netlink function nsh_key_put_from_nlattr() has
> > a similar exception.
> > 
> > Signed-off-by: Ben Pfaff <blp@ovn.org>
> 
> Acked-by: Justin Pettit <jpettit@ovn.org>

Thanks for the reviews.  I applied patches 1 and 2 to master and
branch-2.10.  I look forward to a review of patch 3.

Patch

diff --git a/lib/odp-util.c b/lib/odp-util.c
index 6726869729e7..a3d0ab9362c1 100644
--- a/lib/odp-util.c
+++ b/lib/odp-util.c
@@ -2712,7 +2712,7 @@  odp_nsh_key_from_attr(const struct nlattr *attr, struct ovs_key_nsh *nsh,
         return ODP_FIT_TOO_MUCH;
     }
 
-    if (has_md1 && nsh->mdtype != NSH_M_TYPE1) {
+    if (has_md1 && nsh->mdtype != NSH_M_TYPE1 && !nsh_mask) {
         return ODP_FIT_ERROR;
     }