if (!is_mask && !(present_attrs & (UINT64_C(1) << OVS_KEY_ATTR_VLAN))) {
return ODP_FIT_TOO_LITTLE;
} else {
- tci = nl_attr_get_be16(attrs[OVS_KEY_ATTR_VLAN]);
+ tci = (present_attrs & (UINT64_C(1) << OVS_KEY_ATTR_VLAN)
+ ? nl_attr_get_be16(attrs[OVS_KEY_ATTR_VLAN])
+ : htons(0));
if (!is_mask) {
if (tci == htons(0)) {
/* Corner case for a truncated 802.1Q header. */
return ODP_FIT_ERROR;
}
- if ((is_mask && (src_flow->vlan_tci & htons(VLAN_CFI))) ||
- (!is_mask && src_flow->dl_type == htons(ETH_TYPE_VLAN))) {
+ if (is_mask
+ ? (src_flow->vlan_tci & htons(VLAN_CFI)) != 0
+ : src_flow->dl_type == htons(ETH_TYPE_VLAN)) {
return parse_8021q_onward(attrs, present_attrs, out_of_range_attr,
expected_attrs, flow, key, key_len, src_flow);
}