I have a product for macOS which uses Network Kernel Extensions to get the network data and modify the data based on some pre-defined rules.
As kexts will no longer be supported starting macOS 10.16, I have to port my solution to use Network System Extensions.
I am not able to find out what APIs to use for this purpose.
I looked into NEFilterPacketProvider under Content Filters which can provide me the packet and based on rules I can allow/deny/delay. But is it possible to perform some computation and forward the manipulated data before allowing it??
The NEFilterPacketHandler provides the packetBytes in the form of const void so even though it would be possible to cast const away? Plus there are other expectations here such as packetLength that rely on these bytes staying intact.
typedef NEFilterPacketProviderVerdict (^NEFilterPacketHandler)
(NEFilterPacketContext *context,
nw_interface_t interface,
NETrafficDirection direction,
const void *packetBytes,
const size_t packetLength);