Fragment mask (any and later) always exists so we need to test for FLOW_NW_FRAG_LATER only if the state is FLOW_NW_FRAG_ANY. Before this fix we could pass frag no and first at the same time to TC which is also not tested there for bad frag state. This fix make sure we only pass frag first/later if is frag.
Fixes: 83e866067ea6 ("netdev-tc-offloads: Add support for IP fragmentation") Signed-off-by: Roi Dayan <r...@mellanox.com> Reviewed-by: Paul Blakey <pa...@mellanox.com> --- lib/netdev-tc-offloads.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/lib/netdev-tc-offloads.c b/lib/netdev-tc-offloads.c index f22415ee11bd..6db76801fd0e 100644 --- a/lib/netdev-tc-offloads.c +++ b/lib/netdev-tc-offloads.c @@ -948,14 +948,21 @@ netdev_tc_flow_put(struct netdev *netdev, struct match *match, flower.key.ip_ttl = key->nw_ttl; flower.mask.ip_ttl = mask->nw_ttl; - if (mask->nw_frag) { - if (key->nw_frag & FLOW_NW_FRAG_ANY) + if (mask->nw_frag & FLOW_NW_FRAG_ANY) { + flower.mask.flags |= TCA_FLOWER_KEY_FLAGS_IS_FRAGMENT; + + if (key->nw_frag & FLOW_NW_FRAG_ANY) { flower.key.flags |= TCA_FLOWER_KEY_FLAGS_IS_FRAGMENT; - if (!(key->nw_frag & FLOW_NW_FRAG_LATER)) - flower.key.flags |= TCA_FLOWER_KEY_FLAGS_FRAG_IS_FIRST; - flower.mask.flags |= TCA_FLOWER_KEY_FLAGS_IS_FRAGMENT; - flower.mask.flags |= TCA_FLOWER_KEY_FLAGS_FRAG_IS_FIRST; + if (mask->nw_frag & FLOW_NW_FRAG_LATER) { + flower.mask.flags |= TCA_FLOWER_KEY_FLAGS_FRAG_IS_FIRST; + + if (!(key->nw_frag & FLOW_NW_FRAG_LATER)) { + flower.key.flags |= TCA_FLOWER_KEY_FLAGS_FRAG_IS_FIRST; + } + } + } + mask->nw_frag = 0; } -- 2.7.0 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev