Packet filter(pf) firewall misbehaving (kernel loses all network capability)
Since using macOS Sonoma I have been having problems with the packet filter firewall. Basically what happens is that at some point my network simply dies and it is definitely the Mac not anything else on the network. I test this by running ping 8.8.8.8 which then fails
%ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Etc. Sometimes it even gets me:
% ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
ping: sendto: No route to host
ping: sendto: No route to host
Request timeout for icmp_seq 0
ping: sendto: No route to host
Request timeout for icmp_seq 1
çping: sendto: No route to host
Request timeout for icmp_seq 2
ping: sendto: No route to host
The cause of this has been established with certainty: it is the packet filter, because when I turn that off and on again with:
# pfctl -d
No ALTQ support in kernel
ALTQ related functions disabled
pf disabled
# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
64 bytes from 8.8.8.8: icmp_seq=0 ttl=59 time=14.308 ms
64 bytes from 8.8.8.8: icmp_seq=1 ttl=59 time=12.536 ms
^C
--- 8.8.8.8 ping statistics ---
2 packets transmitted, 2 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 12.536/13.422/14.308/0.886 ms
# pfctl -e
No ALTQ support in kernel
ALTQ related functions disabled
pf enabled
# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
64 bytes from 8.8.8.8: icmp_seq=0 ttl=59 time=15.732 ms
64 bytes from 8.8.8.8: icmp_seq=1 ttl=59 time=14.244 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=59 time=15.379 ms
Simply turning pf off and on again, fixes it.
It seems to me that the kernel somehow has a problem and runs out of resources (so a leak of a kind) which turning pf off and on again, fixes.
Is this already a known problem and if so is there anything I can do (other than turning the firewall off entirely, which I obviously do not like) to prevent this from happening?