diff --git a/bpf/flows.c b/bpf/flows.c index 7294df318dda5092e1faf920bd634c344e9b7dcc..c7f0548586a19a89376ccf1e4a1415884115472d 100644 --- a/bpf/flows.c +++ b/bpf/flows.c @@ -239,15 +239,15 @@ static inline int flow_monitor(struct __sk_buff *skb, u8 direction) { if (extra_metrics != NULL) { update_dns(extra_metrics, &pkt, dns_errno); } else { - additional_metrics new_metrics = { - .start_mono_time_ts = pkt.current_ts, - .end_mono_time_ts = pkt.current_ts, - .eth_protocol = eth_protocol, - .dns_record.id = pkt.dns_id, - .dns_record.flags = pkt.dns_flags, - .dns_record.latency = pkt.dns_latency, - .dns_record.errno = dns_errno, - }; + additional_metrics new_metrics; + __builtin_memset(&new_metrics, 0, sizeof(new_metrics)); + new_metrics.start_mono_time_ts = pkt.current_ts; + new_metrics.end_mono_time_ts = pkt.current_ts; + new_metrics.eth_protocol = eth_protocol; + new_metrics.dns_record.id = pkt.dns_id; + new_metrics.dns_record.flags = pkt.dns_flags; + new_metrics.dns_record.latency = pkt.dns_latency; + new_metrics.dns_record.errno = dns_errno; long ret = bpf_map_update_elem(&additional_flow_metrics, &id, &new_metrics, BPF_NOEXIST); if (ret != 0) { diff --git a/bpf/network_events_monitoring.h b/bpf/network_events_monitoring.h index 073d24206aaf44a65c37f4fcc8c088e9db6982ef..5d4687e28895b50e6a805417bd993038ac8bcc21 100644 --- a/bpf/network_events_monitoring.h +++ b/bpf/network_events_monitoring.h @@ -106,12 +106,12 @@ static inline int trace_network_events(struct sk_buff *skb, struct rh_psample_me // there is no matching flows so lets create new one and add the network event metadata u64 current_time = bpf_ktime_get_ns(); - additional_metrics new_flow = { - .start_mono_time_ts = current_time, - .end_mono_time_ts = current_time, - .eth_protocol = eth_protocol, - .network_events_idx = 0, - }; + additional_metrics new_flow; + __builtin_memset(&new_flow, 0, sizeof(new_flow)); + new_flow.start_mono_time_ts = current_time; + new_flow.end_mono_time_ts = current_time; + new_flow.eth_protocol = eth_protocol; + new_flow.network_events_idx = 0; bpf_probe_read_kernel(new_flow.network_events[0], md_len, user_cookie); new_flow.network_events_idx++; ret = bpf_map_update_elem(&additional_flow_metrics, &id, &new_flow, BPF_NOEXIST); diff --git a/bpf/pkt_drops.h b/bpf/pkt_drops.h index 74d0735541d1fef1629aba053810e565ffb44ec3..347711f4f504a0f850842c5839f8318c9d185ee2 100644 --- a/bpf/pkt_drops.h +++ b/bpf/pkt_drops.h @@ -75,16 +75,16 @@ static inline int trace_pkt_drop(void *ctx, u8 state, struct sk_buff *skb, } // there is no matching flows so lets create new one and add the drops u64 current_time = bpf_ktime_get_ns(); - additional_metrics new_flow = { - .start_mono_time_ts = current_time, - .end_mono_time_ts = current_time, - .eth_protocol = eth_protocol, - .pkt_drops.packets = 1, - .pkt_drops.bytes = len, - .pkt_drops.latest_state = state, - .pkt_drops.latest_flags = flags, - .pkt_drops.latest_drop_cause = reason, - }; + additional_metrics new_flow; + __builtin_memset(&new_flow, 0, sizeof(new_flow)); + new_flow.start_mono_time_ts = current_time; + new_flow.end_mono_time_ts = current_time; + new_flow.eth_protocol = eth_protocol; + new_flow.pkt_drops.packets = 1; + new_flow.pkt_drops.bytes = len; + new_flow.pkt_drops.latest_state = state; + new_flow.pkt_drops.latest_flags = flags; + new_flow.pkt_drops.latest_drop_cause = reason; ret = bpf_map_update_elem(&additional_flow_metrics, &id, &new_flow, BPF_NOEXIST); if (ret != 0) { if (trace_messages && ret != -EEXIST) { diff --git a/bpf/pkt_translation.h b/bpf/pkt_translation.h index 661a258103a866deab85f7385e7e6a3fd137fb4a..13ec5a50e8a22ac6a2c5566acbb8ffd9557f7fcd 100644 --- a/bpf/pkt_translation.h +++ b/bpf/pkt_translation.h @@ -94,11 +94,11 @@ static inline long translate_lookup_and_update_flow(flow_id *id, u16 flags, } // there is no matching flows so lets create new one and add the xlation - additional_metrics new_extra_metrics = { - .start_mono_time_ts = current_time, - .end_mono_time_ts = current_time, - .eth_protocol = eth_protocol, - }; + additional_metrics new_extra_metrics; + __builtin_memset(&new_extra_metrics, 0, sizeof(new_extra_metrics)); + new_extra_metrics.start_mono_time_ts = current_time; + new_extra_metrics.end_mono_time_ts = current_time; + new_extra_metrics.eth_protocol = eth_protocol; parse_tuple(reply_t, &new_extra_metrics.translated_flow, zone_id, family, id->transport_protocol, true); ret = bpf_map_update_elem(&additional_flow_metrics, id, &new_extra_metrics, BPF_NOEXIST); diff --git a/bpf/rtt_tracker.h b/bpf/rtt_tracker.h index c102557af213ad386eb8bfefec8e94de797fb3e7..c03169d6711f1e7fa73c6f05a5b1e972db8e6337 100644 --- a/bpf/rtt_tracker.h +++ b/bpf/rtt_tracker.h @@ -71,12 +71,12 @@ static inline int calculate_flow_rtt_tcp(struct sock *sk, struct sk_buff *skb) { } u64 current_time = bpf_ktime_get_ns(); - additional_metrics new_flow = { - .start_mono_time_ts = current_time, - .end_mono_time_ts = current_time, - .eth_protocol = eth_protocol, - .flow_rtt = rtt, - }; + additional_metrics new_flow; + __builtin_memset(&new_flow, 0, sizeof(new_flow)); + new_flow.start_mono_time_ts = current_time; + new_flow.end_mono_time_ts = current_time; + new_flow.eth_protocol = eth_protocol; + new_flow.flow_rtt = rtt; ret = bpf_map_update_elem(&additional_flow_metrics, &id, &new_flow, BPF_NOEXIST); if (ret != 0) { if (trace_messages && ret != -EEXIST) { diff --git a/pkg/ebpf/bpf_arm64_bpfel.o b/pkg/ebpf/bpf_arm64_bpfel.o index ba66aed622988aaa96dac61e95f2f5ac06b9291e..706f43fb00c82daa7f9f4194997fc5e204db5712 100644 Binary files a/pkg/ebpf/bpf_arm64_bpfel.o and b/pkg/ebpf/bpf_arm64_bpfel.o differ diff --git a/pkg/ebpf/bpf_powerpc_bpfel.o b/pkg/ebpf/bpf_powerpc_bpfel.o index 7e1c246df3f1121bad83416ce0a03eba78f58570..f5c2f4d479c92c8f4d604fdb4759573d98f62bae 100644 Binary files a/pkg/ebpf/bpf_powerpc_bpfel.o and b/pkg/ebpf/bpf_powerpc_bpfel.o differ diff --git a/pkg/ebpf/bpf_s390_bpfeb.o b/pkg/ebpf/bpf_s390_bpfeb.o index 06935a4c07c604bdc81497fa6606224533ac1b79..8d3338d220a7e55e5158c0cbfd8a29616c7a0cc2 100644 Binary files a/pkg/ebpf/bpf_s390_bpfeb.o and b/pkg/ebpf/bpf_s390_bpfeb.o differ diff --git a/pkg/ebpf/bpf_x86_bpfel.o b/pkg/ebpf/bpf_x86_bpfel.o index bd7cd47ba4e563a2bc3b74c455619546c08f2a35..9e16c66d847e8cd3f0ea3b6a82f6fe98a57122d6 100644 Binary files a/pkg/ebpf/bpf_x86_bpfel.o and b/pkg/ebpf/bpf_x86_bpfel.o differ