diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2023-09-10 21:46:51 +0200 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2023-09-10 21:46:51 +0200 |
commit | 0a0342ce2826b00e0d51d875ed863c7623b139f3 (patch) | |
tree | 7a70c6974d217c4260b18ca8fa6b6704fc8c74cc /examples | |
parent | 7515c1b07263d2ca542a46dff68b4d800b7eaf81 (diff) |
c-captured: Log only flows w/o packet data to syslog if in logging mode.
* CI Fix #2
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/c-captured/c-captured.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/examples/c-captured/c-captured.c b/examples/c-captured/c-captured.c index 12829267c..8eac71ab3 100644 --- a/examples/c-captured/c-captured.c +++ b/examples/c-captured/c-captured.c @@ -6,6 +6,7 @@ #include <netinet/udp.h> #include <pcap/pcap.h> #include <signal.h> +#include <stdbool.h> // ndpi_typedefs.h #include <stdint.h> #include <stdio.h> #include <stdlib.h> @@ -937,10 +938,13 @@ static enum nDPIsrvd_callback_return captured_json_callback(struct nDPIsrvd_sock syslog_event(sock, flow, "midstream"); } - if (capture_mode != 0 && (flow_user->packets == NULL || flow_user->flow_max_packets == 0 || - utarray_len(flow_user->packets) == 0)) + if ((flow_user->packets == NULL || flow_user->flow_max_packets == 0 || + utarray_len(flow_user->packets) == 0)) { - syslog(LOG_DAEMON | LOG_ERR, "Flow %llu: No packets captured.", flow->id_as_ull); + if (logging_mode != 0) + { + syslog(LOG_DAEMON | LOG_ERR, "Flow %llu: No packets captured.", flow->id_as_ull); + } } else if (capture_mode != 0) { |