Skip to content
Snippets Groups Projects
Unverified Commit 528ec8c1 authored by Mohamed S. Mahmoud's avatar Mohamed S. Mahmoud Committed by GitHub
Browse files

Merge pull request #534 from msherif1234/fix_4.15_verifier_err

NETOBSERV-2051: Fix eBPF verifier errors with 5.14.0-284.71.1.el9_2
parents dd5826d2 ecdb4830
No related branches found
No related tags found
No related merge requests found
...@@ -239,15 +239,15 @@ static inline int flow_monitor(struct __sk_buff *skb, u8 direction) { ...@@ -239,15 +239,15 @@ static inline int flow_monitor(struct __sk_buff *skb, u8 direction) {
if (extra_metrics != NULL) { if (extra_metrics != NULL) {
update_dns(extra_metrics, &pkt, dns_errno); update_dns(extra_metrics, &pkt, dns_errno);
} else { } else {
additional_metrics new_metrics = { additional_metrics new_metrics;
.start_mono_time_ts = pkt.current_ts, __builtin_memset(&new_metrics, 0, sizeof(new_metrics));
.end_mono_time_ts = pkt.current_ts, new_metrics.start_mono_time_ts = pkt.current_ts;
.eth_protocol = eth_protocol, new_metrics.end_mono_time_ts = pkt.current_ts;
.dns_record.id = pkt.dns_id, new_metrics.eth_protocol = eth_protocol;
.dns_record.flags = pkt.dns_flags, new_metrics.dns_record.id = pkt.dns_id;
.dns_record.latency = pkt.dns_latency, new_metrics.dns_record.flags = pkt.dns_flags;
.dns_record.errno = dns_errno, new_metrics.dns_record.latency = pkt.dns_latency;
}; new_metrics.dns_record.errno = dns_errno;
long ret = long ret =
bpf_map_update_elem(&additional_flow_metrics, &id, &new_metrics, BPF_NOEXIST); bpf_map_update_elem(&additional_flow_metrics, &id, &new_metrics, BPF_NOEXIST);
if (ret != 0) { if (ret != 0) {
......
...@@ -106,12 +106,12 @@ static inline int trace_network_events(struct sk_buff *skb, struct rh_psample_me ...@@ -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 // there is no matching flows so lets create new one and add the network event metadata
u64 current_time = bpf_ktime_get_ns(); u64 current_time = bpf_ktime_get_ns();
additional_metrics new_flow = { additional_metrics new_flow;
.start_mono_time_ts = current_time, __builtin_memset(&new_flow, 0, sizeof(new_flow));
.end_mono_time_ts = current_time, new_flow.start_mono_time_ts = current_time;
.eth_protocol = eth_protocol, new_flow.end_mono_time_ts = current_time;
.network_events_idx = 0, 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); bpf_probe_read_kernel(new_flow.network_events[0], md_len, user_cookie);
new_flow.network_events_idx++; new_flow.network_events_idx++;
ret = bpf_map_update_elem(&additional_flow_metrics, &id, &new_flow, BPF_NOEXIST); ret = bpf_map_update_elem(&additional_flow_metrics, &id, &new_flow, BPF_NOEXIST);
......
...@@ -75,16 +75,16 @@ static inline int trace_pkt_drop(void *ctx, u8 state, struct sk_buff *skb, ...@@ -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 // there is no matching flows so lets create new one and add the drops
u64 current_time = bpf_ktime_get_ns(); u64 current_time = bpf_ktime_get_ns();
additional_metrics new_flow = { additional_metrics new_flow;
.start_mono_time_ts = current_time, __builtin_memset(&new_flow, 0, sizeof(new_flow));
.end_mono_time_ts = current_time, new_flow.start_mono_time_ts = current_time;
.eth_protocol = eth_protocol, new_flow.end_mono_time_ts = current_time;
.pkt_drops.packets = 1, new_flow.eth_protocol = eth_protocol;
.pkt_drops.bytes = len, new_flow.pkt_drops.packets = 1;
.pkt_drops.latest_state = state, new_flow.pkt_drops.bytes = len;
.pkt_drops.latest_flags = flags, new_flow.pkt_drops.latest_state = state;
.pkt_drops.latest_drop_cause = reason, 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); ret = bpf_map_update_elem(&additional_flow_metrics, &id, &new_flow, BPF_NOEXIST);
if (ret != 0) { if (ret != 0) {
if (trace_messages && ret != -EEXIST) { if (trace_messages && ret != -EEXIST) {
......
...@@ -94,11 +94,11 @@ static inline long translate_lookup_and_update_flow(flow_id *id, u16 flags, ...@@ -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 // there is no matching flows so lets create new one and add the xlation
additional_metrics new_extra_metrics = { additional_metrics new_extra_metrics;
.start_mono_time_ts = current_time, __builtin_memset(&new_extra_metrics, 0, sizeof(new_extra_metrics));
.end_mono_time_ts = current_time, new_extra_metrics.start_mono_time_ts = current_time;
.eth_protocol = eth_protocol, 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, parse_tuple(reply_t, &new_extra_metrics.translated_flow, zone_id, family,
id->transport_protocol, true); id->transport_protocol, true);
ret = bpf_map_update_elem(&additional_flow_metrics, id, &new_extra_metrics, BPF_NOEXIST); ret = bpf_map_update_elem(&additional_flow_metrics, id, &new_extra_metrics, BPF_NOEXIST);
......
...@@ -71,12 +71,12 @@ static inline int calculate_flow_rtt_tcp(struct sock *sk, struct sk_buff *skb) { ...@@ -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(); u64 current_time = bpf_ktime_get_ns();
additional_metrics new_flow = { additional_metrics new_flow;
.start_mono_time_ts = current_time, __builtin_memset(&new_flow, 0, sizeof(new_flow));
.end_mono_time_ts = current_time, new_flow.start_mono_time_ts = current_time;
.eth_protocol = eth_protocol, new_flow.end_mono_time_ts = current_time;
.flow_rtt = rtt, new_flow.eth_protocol = eth_protocol;
}; new_flow.flow_rtt = rtt;
ret = bpf_map_update_elem(&additional_flow_metrics, &id, &new_flow, BPF_NOEXIST); ret = bpf_map_update_elem(&additional_flow_metrics, &id, &new_flow, BPF_NOEXIST);
if (ret != 0) { if (ret != 0) {
if (trace_messages && ret != -EEXIST) { if (trace_messages && ret != -EEXIST) {
......
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment