MacOS – Where can i find the source code for the pfctl utility

firewallmacosopen sourcepfctl

I have looked here: https://github.com/apple/darwin-xnu

But all i can find is the 'back end' for the pfctl tool, but i am interested in the command-line pfctl tool itself, the option parser and so on.

Has Apple released source code for this or documented it in a manual page for 10.14.1?

Best Answer

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.