Where can i find the source code for the pfctl utility?

Solution 1:

A path name embedded in the pfctl executable on my Mojave system:

/BuildRoot/Library/Caches/com.apple.xbs/Sources/PacketFilter/PacketFilter-85/pfctl/pfctl_optimize.c

suggests that it's part of a "PacketFilter" package which Apple hasn't released.

However, this filename suggests that the tool is very similar (if not identical) to the OpenBSD utility of the same name.