conntrack: Increment coverage counter for all bad checksum cases.
conntrack_l4csum_err gets incremented only when corrupted icmp pass
through conntrack.  Increase it for the remaining bad checksum cases
including when checksum is offloaded.
Fixes: ("conntrack: Add coverage count for l4csum error.")
Acked-by: Tonghao Zhang
@@ -1669,15 +1669,22 @@ static inline bool
checksum_valid(const struct conn_key *key, const void *data, size_t size,
const void *l3)
{
+ bool valid;
+
if (key->dl_type == htons(ETH_TYPE_IP)) {
uint32_t csum = packet_csum_pseudoheader(l3);
- return csum_finish(csum_continue(csum, data, size)) == 0;
+ valid = (csum_finish(csum_continue(csum, data, size)) == 0);
} else if (key->dl_type == htons(ETH_TYPE_IPV6)) {
- return packet_csum_upperlayer6(l3, data, key->nw_proto, size) == 0;
+ valid = (packet_csum_upperlayer6(l3, data, key->nw_proto, size) == 0);
} else {
+ valid = false;
+ }
+
+ if (!valid) {
COVERAGE_INC(conntrack_l4csum_err);
- return false;
}
+
+ return valid;
}
static inline bool
@@ -2076,6 +2083,8 @@ conn_key_extract(struct conntrack *ct, struct dp_packet *pkt, ovs_be16 dl_type,
ctx->hash = conn_key_hash(&ctx->key, ct->hash_basis);
return true;
}
+ } else {
+ COVERAGE_INC(conntrack_l4csum_err);
}
}
