You can run wireshark on your gateway. IP headers probably won't be encrypted.

Also, Linux is open source. You could review the kernel and compile the code you read on your own.