add more logging for missing tpacket_auxdata cmsg

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: If4ee940d4694e3f3197e14c8da9f9cd80080eee7
diff --git a/clatd.c b/clatd.c
index 9a7a45a..bac8b1d 100644
--- a/clatd.c
+++ b/clatd.c
@@ -88,18 +88,29 @@
     return;
   }
 
+  bool ok = false;
   __u32 tp_status = 0;
   __u16 tp_net = 0;
 
   for (struct cmsghdr *cmsg = CMSG_FIRSTHDR(&msgh); cmsg != NULL; cmsg = CMSG_NXTHDR(&msgh,cmsg)) {
     if (cmsg->cmsg_level == SOL_PACKET && cmsg->cmsg_type == PACKET_AUXDATA) {
       struct tpacket_auxdata *aux = (struct tpacket_auxdata *)CMSG_DATA(cmsg);
+      ok = true;
       tp_status = aux->tp_status;
       tp_net = aux->tp_net;
       break;
     }
   }
 
+  if (!ok) {
+    // theoretically this should not happen...
+    static bool logged = false;
+    if (!logged) {
+      logmsg(ANDROID_LOG_ERROR, "%s: failed to fetch tpacket_auxdata cmsg", __func__);
+      logged = true;
+    }
+  }
+
   const int payload_offset = offsetof(typeof(buf), payload);
   if (readlen < payload_offset + tp_net) {
     logmsg(ANDROID_LOG_WARN, "%s: ignoring %zd byte pkt shorter than %d+%u L2 header",