diff mbox series

[ovs-dev,v2] conntrack: add coverage counters for L3 bad checksum

Message ID 161980273210.95131.8863959545804983824.stgit@fed.void
State Accepted
Headers show
Series [ovs-dev,v2] conntrack: add coverage counters for L3 bad checksum | expand

Commit Message

Paolo Valerio April 30, 2021, 5:12 p.m. UTC
similarly to what already exists for L4, add conntrack_l3csum_err
and ipf_l3csum_err for L3.

Received packets with L3 bad checksum will increase respectively
ipf_l3csum_err if they are fragments and conntrack_l3csum_err
otherwise.

Although the patch basically covers IPv4, the names are kept generic.

Signed-off-by: Paolo Valerio <pvalerio@redhat.com>
---
 lib/conntrack.c |    3 +++
 lib/ipf.c       |    3 +++
 2 files changed, 6 insertions(+)

Comments

Eelco Chaudron May 11, 2021, 12:18 p.m. UTC | #1
On 30 Apr 2021, at 19:12, Paolo Valerio wrote:

> similarly to what already exists for L4, add conntrack_l3csum_err
> and ipf_l3csum_err for L3.
>
> Received packets with L3 bad checksum will increase respectively
> ipf_l3csum_err if they are fragments and conntrack_l3csum_err
> otherwise.
>
> Although the patch basically covers IPv4, the names are kept generic.

Looks good to me!

Acked-by: Eelco Chaudron <echaudro@redhat.com>
Aaron Conole May 11, 2021, 2:52 p.m. UTC | #2
Paolo Valerio <pvalerio@redhat.com> writes:

> similarly to what already exists for L4, add conntrack_l3csum_err
> and ipf_l3csum_err for L3.
>
> Received packets with L3 bad checksum will increase respectively
> ipf_l3csum_err if they are fragments and conntrack_l3csum_err
> otherwise.
>
> Although the patch basically covers IPv4, the names are kept generic.
>
> Signed-off-by: Paolo Valerio <pvalerio@redhat.com>
> ---

Reviewed-by: Aaron Conole <aconole@redhat.com>
Ilya Maximets July 1, 2021, 3:08 p.m. UTC | #3
On 4/30/21 7:12 PM, Paolo Valerio wrote:
> similarly to what already exists for L4, add conntrack_l3csum_err
> and ipf_l3csum_err for L3.
> 
> Received packets with L3 bad checksum will increase respectively
> ipf_l3csum_err if they are fragments and conntrack_l3csum_err
> otherwise.
> 
> Although the patch basically covers IPv4, the names are kept generic.
> 
> Signed-off-by: Paolo Valerio <pvalerio@redhat.com>
> ---


Thanks!  Applied.

Best regards, Ilya Maximets.
diff mbox series

Patch

diff --git a/lib/conntrack.c b/lib/conntrack.c
index 99198a601..70cdcc12a 100644
--- a/lib/conntrack.c
+++ b/lib/conntrack.c
@@ -45,6 +45,7 @@  VLOG_DEFINE_THIS_MODULE(conntrack);
 
 COVERAGE_DEFINE(conntrack_full);
 COVERAGE_DEFINE(conntrack_long_cleanup);
+COVERAGE_DEFINE(conntrack_l3csum_err);
 COVERAGE_DEFINE(conntrack_l4csum_err);
 
 struct conn_lookup_ctx {
@@ -1613,6 +1614,7 @@  extract_l3_ipv4(struct conn_key *key, const void *data, size_t size,
     }
 
     if (validate_checksum && csum(data, ip_len) != 0) {
+        COVERAGE_INC(conntrack_l3csum_err);
         return false;
     }
 
@@ -2051,6 +2053,7 @@  conn_key_extract(struct conntrack *ct, struct dp_packet *pkt, ovs_be16 dl_type,
         bool hwol_bad_l3_csum = dp_packet_ip_checksum_bad(pkt);
         if (hwol_bad_l3_csum) {
             ok = false;
+            COVERAGE_INC(conntrack_l3csum_err);
         } else {
             bool hwol_good_l3_csum = dp_packet_ip_checksum_valid(pkt)
                                      || dp_packet_hwol_is_ipv4(pkt);
diff --git a/lib/ipf.c b/lib/ipf.c
index c20bcc0b3..f26e7d492 100644
--- a/lib/ipf.c
+++ b/lib/ipf.c
@@ -36,6 +36,7 @@ 
 
 VLOG_DEFINE_THIS_MODULE(ipf);
 COVERAGE_DEFINE(ipf_stuck_frag_list_purged);
+COVERAGE_DEFINE(ipf_l3csum_err);
 
 enum {
     IPV4_PACKET_MAX_HDR_SIZE = 60,
@@ -575,6 +576,7 @@  static bool
 ipf_is_valid_v4_frag(struct ipf *ipf, struct dp_packet *pkt)
 {
     if (OVS_UNLIKELY(dp_packet_ip_checksum_bad(pkt))) {
+        COVERAGE_INC(ipf_l3csum_err);
         goto invalid_pkt;
     }
 
@@ -610,6 +612,7 @@  ipf_is_valid_v4_frag(struct ipf *ipf, struct dp_packet *pkt)
     if (OVS_UNLIKELY(!dp_packet_ip_checksum_valid(pkt)
                      && !dp_packet_hwol_is_ipv4(pkt)
                      && csum(l3, ip_hdr_len) != 0)) {
+        COVERAGE_INC(ipf_l3csum_err);
         goto invalid_pkt;
     }