...
#define PATH_SEGMENT_LEN 255
typedef unsigned char path_segment[PATH_SEGMENT_LEN];
...
path_segment *a = bpf_map_lookup_elem(&cpu_buffer, &j);
if (!a)
{
break;
}
path_segment *b = current_element->path_elements[i];
...
I need to know if a and b are equal, which both are dynamicly sized. I tried __builtin_memcmp
but that still returns false even though the strings are equal. The compiler doesn’t seem to like a dynamic size for it because it cannot link it when I do that?
*a
comes from a bpf_probe_read_kernel_str
stored in a BPF_MAP_TYPE_PERCPU_ARRAY
*b
comes from current_element
which is a argument from bpf_for_each_map_elem
which loops over an BPF_MAP_TYPE_ARRAY
Is it possible to compare two dynamicly sized strings?