Firewall on iPhone/iOS (ipfw or pf) I want to run ipfw or pf on my iPhone -- or the equivalent.  Seems simple, but I can't find anything that works.  

Device is jailbroken, looked very carefully through Cydia, and even through some of the alternate repositories.  I've tried off and on for months, digging and digging, it's been really frustrating.

I found this post: Can I block ports and network traffic when using Personal Hotspot? here on apple.stackexchange, and tried installing ipfw via theworm.altervista.org/cydia.  It installed without issue, but no matter what I do it just says: 

ipfw: getsockopt(IP_FW_GET): Protocol not available


Found this post: http://nixcraft.com/all-about-freebsd-openbsd-netbsd/3726-ipfw-getsockopt-ip_fw_get-protocol-not-available.html which suggests creating a file: /etc/rc.conf, with the following:

firewall_enable="YES"
firewall_script="/usr/local/etc/ipfw.rules"


But that didn't help at all, still get the same error.

I'm aware of the Cydia/commercial software "IP Firewall", which would help with much of what I want to do, but not everything. 

Please help!
It seems "simple", but ipfw (or pf) require support directly within the kernel. That means Apple has to compile the iOS kernel to support those particular utilities and their required protocols (ipfw is a front end for ipfw and dummynet, the latter of which does the bandwidth shaping).

Firewall software (like ipfw) in Unix based systems run at the kernel layer (deep) and cannot be added unless the kernel itself supports them. OS X supports ipfw/pf but iOS does not. Apple has gone through great lengths to secure the OS and likely feels it an unnecessary addition (it's not that Apple has turned them off, they simply do not exist so no conf configurations will aid you). This is why you receive the protocol error. While iOS can run the program, ipfw cannot negotiate the required protocols because they simply do not exist. 

At best, your only option is to find a firewall that runs atop the kernel, so in userspace (like Little Snitch on OS X for example).