cleanup: drop ucode, share BPF/agent flow types, exporter + logging rework - #7
Merged
Conversation
bumpversion only updated obserwrt/Makefile PKG_VERSION, so the v0.3.0 release shipped obserwrt_0.2.6_amd64.deb (CPack uses PROJECT_VERSION). - CMakeLists project VERSION -> 0.3.0 (also fixes --version/build_info on the Linux build; the OpenWrt -DOBSEWRRT_VERSION cache var is superseded) - .bumpversion.cfg now bumps CMakeLists.txt together with PKG_VERSION
…r transport - Drop the deprecated ucode agent entirely: `obserwrt/files/usr/share/ucode/`, the fw4-style `obserwrt/tests/`, `scripts/emit-test.uc`/uc-lint.mjs/ build-ucode.sh, the build-ucode action and their CI steps. - Move the eBPF source to `bpf/obserwrt-bpf.c` and add `bpf/obserwrt-flow.h` as the single source for the §5 flow key/value layouts, shared by the BPF program and the C++ agent (native byte order; no struct-string packing). - Drop the abstract Sink/external-transport ownership: exporters own a UdpClient, datagrams are std::byte buffers passed as spans, failures are counted via UdpClient::take_failures() and folded into the export-error metric each lifecycle pass. IPFIX encodes big-endian via std::byteswap. - FlowMap is typed (FlowKey/FlowValue structs instead of raw map blobs); lifecycle tracker keyed by the packed key instead of its hex.
Replace the short single-line field-list comment with a full IANA IPFIX IE reference (markdown table: IE id, field, length, meaning) covering both the v4 and v6 templates, and expand the v6 field list one entry per line with the same per-field comments as v4.
- Add src/logfmt.hpp: a miniature exceptions-free logfmt logger (SLOG macro, message-first msg= field, conditional quoting/escaping) gated by main.log_level, replacing the printf-style DAEMON_LOG everywhere. - Remove the dead DAEMON_LOG macro from log.hpp (only g_log_level remains). - exporter_ipfix: build each datagram into one pre-sized buffer and reserve exact record sizes in emit(), eliminating the intermediate body copy and per-field reallocations. - Wire formats are untouched: flow-record encoders (encode_json/logfmt) stay hand-rolled and pinned by the golden harness.
CI (Ubuntu 24.04) ships clang-format 18, which wraps the SLOG fluent chains differently than the local v22. Reformat to the v18 layout so the clang-format gate passes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
One cleanup PR over the v0.3.0 C++ rewrite that removes what ucode left behind and tightens the exporter/logging design.
Drop the deprecated ucode agent
obserwrt/files/usr/share/ucode/, the fw4-styleobserwrt/tests/,scripts/emit-test.uc,uc-lint.mjs,build-ucode.sh, thebuild-ucodeaction and their CI steps.bpf/).Shared flow types (BPF ⇋ agent)
bpf/obserwrt-bpf.c; newbpf/obserwrt-flow.his the single source for the §5 key/value layouts, included by both the program andflow.hpp.FlowMapis now typed (FlowKey/FlowValuestructs passed straight to libbpf), lifecycle tracker keyed by the packed key instead of hex.Exporter design fix
Sink+ external-transport ownership: exporters own aUdpClient, datagrams arestd::bytebuffers passed as spans, failures counted viaUdpClient::take_failures()and folded intoobserwrt_export_errors_totaleach pass.std::byteswap; datagrams are assembled into one pre-sized buffer (no intermediate copies).Diagnostics
src/logfmt.hpp: miniature exceptions-free logfmt logger (SLOG), message-first, gated bymain.log_level; replaces printf-styleDAEMON_LOG(macro removed). Flow-record encoders are untouched (pinned by the golden harness).Testing
cmakebuild clean (0 warnings/errors),ctestgolden-vector harness passes.bpfelandbpfeb.