pavel-odintsov / fastnetmon

FastNetMon - very fast DDoS sensor with sFlow/Netflow/IPFIX/SPAN support
https://fastnetmon.com
GNU General Public License v2.0
3.41k stars 567 forks source link

Weird BPF related compilation issues on Debian 10 and Ubuntu 20 #947

Open pavel-odintsov opened 1 year ago

pavel-odintsov commented 1 year ago
In file included from /tmp/fastnetmon.build.dir.V5QUf72HFb/fastnetmon/src/xdp_plugin/xdp_collector.cpp:14:
/opt/fastnetmon-community/libraries/libbpf_1_0_1/include/bpf/bpf.h:396:6: error: use of enum 'bpf_stats_type' without previous declaration
  396 | enum bpf_stats_type; /* defined in up-to-date linux/bpf.h */
      |      ^~~~~~~~~~~~~~
/opt/fastnetmon-community/libraries/libbpf_1_0_1/include/bpf/bpf.h:397:38: error: use of enum 'bpf_stats_type' without previous declaration
  397 | LIBBPF_API int bpf_enable_stats(enum bpf_stats_type type);
      |                                      ^~~~~~~~~~~~~~
In file included from /tmp/fastnetmon.build.dir.V5QUf72HFb/fastnetmon/src/xdp_plugin/xdp_collector.cpp:15:
/opt/fastnetmon-community/libraries/libbpf_1_0_1/include/bpf/libbpf.h:70:54: error: use of enum 'bpf_link_type' without previous declaration
   70 | LIBBPF_API const char *libbpf_bpf_link_type_str(enum bpf_link_type t);
      |                                                      ^~~~~~~~~~~~~
[ 25%] Linking CXX static library libpatricia.a
pavel-odintsov commented 1 year ago

Addressed compilation bug via nasty workaround: https://github.com/pavel-odintsov/fastnetmon/commit/3b912332801c85dd5840cedb6bb248a339056187

But I do not like having such complex workaround in our code.

pavel-odintsov commented 1 year ago

Upstream link to bug: https://github.com/libbpf/libbpf/issues/249

pavel-odintsov commented 1 year ago

Long term bug arrived and I hope it will be in next stable libbpf release

pavel-odintsov commented 1 year ago

We can try rebasing to latest libbpf in attempt to fix it without out workaround: https://github.com/libbpf/libbpf/releases/tag/v1.1.0