clatd: log checksum issues only once
Test: TreeHugger
Bug: 269387841
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Icb6ea6d801f5234ea51b4cad25f7b8b17a541977
diff --git a/clatd.c b/clatd.c
index 7eb7904..98f5195 100644
--- a/clatd.c
+++ b/clatd.c
@@ -20,6 +20,7 @@
#include <fcntl.h>
#include <poll.h>
#include <signal.h>
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -118,7 +119,11 @@
// This will detect a skb->ip_summed == CHECKSUM_PARTIAL packet with non-final L4 checksum
if (tp_status & TP_STATUS_CSUMNOTREADY) {
- logmsg(ANDROID_LOG_WARN, "read_packet checksum not ready");
+ static bool logged = false;
+ if (!logged) {
+ logmsg(ANDROID_LOG_WARN, "read_packet checksum not ready");
+ logged = true;
+ }
}
translate_packet(tunnel->fd4, 0 /* to_ipv6 */, buf, readlen);