chore(refactor): collapse conntrack into packetparser#2251
Draft
nddq wants to merge 1 commit into
Draft
Conversation
Conntrack wasn't a plugin — it never implemented the plugin interface or self-registered, and its only real consumers were packetparser and a GC loop that ran iff packetparser was enabled. Move it into the packetparser package so the relationship is explicit. - Merge _cprog/conntrack.c into _cprog/conntrack.h; packetparser.c includes it directly and packetparser.o now owns the retina_conntrack map via LIBBPF_PIN_BY_NAME. Drop the separate bpf2go target. - Move the userspace GC loop into packetparser as a free function; packetParser.Start() launches it. - Add packetparser.InitConntrackMap() for the init container to pre-create and pin the map from packetparser's generated spec. The agent container isn't privileged enough to pin new maps, so the pin must already exist when packetparser.o is loaded. - Drop the packetparser-enabled special case from pluginmanager — packetparser owns its own conntrack lifecycle now. Signed-off-by: Quang Nguyen <nguyenquang@microsoft.com>
e18a24e to
f1ee412
Compare
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.
Description
pkg/plugin/conntrack/lived underpkg/plugin/but was never actually a plugin — it didn't implement the plugin interface, didn't self-register ininclude_linux.go, and its only real consumers were packetparser (which#included conntrack's C code directly) and a GC loop that pluginmanager launched iff packetparser was enabled. The arrangement obscured the fact that conntrack is a component of packetparser.This PR collapses conntrack into the packetparser package so the relationship is explicit.
_cprog/conntrack.cinto_cprog/conntrack.hand move it into packetparser's_cprog/.packetparser.cnow includesconntrack.honce (previously included both.cand.h). Drop the separatebpf2gotarget —packetparser.oowns theretina_conntrackmap viaLIBBPF_PIN_BY_NAME.pkg/plugin/packetparser/conntrack_linux.goas a free function.packetParser.Start()launches it; it operates onp.objs.RetinaConntrackdirectly (no moreebpf.LoadPinnedMap).packetparser.InitConntrackMap()for the init container to pre-create and pin the map from packetparser's generated spec. The agent container isn't privileged enough to pin new maps, so the pin must already exist whenpacketparser.ois loaded in the agent container.pluginNamePacketparserspecial case and the associatedconntrack.New/Runblock — packetparser owns its own lifecycle now.packetparser_ebpf_test.godrops the separate conntrackdynamic.hwrite and the-I../conntrack/_cprog/include.Related Issue
N/A
Checklist
git commit -S -s ...). See this documentation on signing commits.Screenshots (if applicable) or Testing Completed
Additional Notes