Skip to content

Conversation

@brooksdavis
Copy link
Member

I took the libnetdissect used internally in tcpdump's build and inspired by our early compartmentalization work and then added sub-library compartments. We'll need to audit the result to see what linkage surprises there are, but it's a start.

The version now comes from the PACKAGE_VERSION macro.

Fixes:		0a7e5f1 ("tcpdump: Update to 4.99.5")
This macro was replaced by a collection of architecture ifdefs in
tcpdump 4.99.4 (commit 51a1830) so defining it does nothing.
Due to the use of a linked list pointer at the beginning of the object,
the bounds won't be exact in some cases without a refactor to separate
the linked list from the allocation, but this is quick and easy.
Split SRCS entries into core bits of tcpdump, core bits of the
dissection framework, and individual dissectors.
This mirrors an internal split in upstream to enable
compartmentlization.  We differ slightly from upstream in that we
keep addrtoname.c in tcpdump due to its use of casper for DNS lookups.
Likewise machdep.c is only used by tcpdump.
Each set of dissectors (as indicated by a separate print-*.c file) goes
in its own compartment (with utilities added manually in a few cases).
Most of the rest go an the default compartment except for a manual
compartment for MD5 signature verification.
@brooksdavis brooksdavis changed the base branch from main to dev August 28, 2025 12:51
@brooksdavis
Copy link
Member Author

Having done the compartmentalization via a library, I'm not sure it was the right approach. It's a mess in the build system and while the split needs to be there, it could just be in the policy file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants