Reputation: 51
How can we set the ttl field using setsockopt in kernel hook module?
We can put an entry in iptables mangle but is there an alternative better way?
I am currently using ubuntu 14.04, kernel 3.13.2 CPU is 32 bit
Upvotes: 0
Views: 1039
Reputation: 13065
setsockopt
is a call into the kernel. If you are writing a kernel module, you need to stop thinking in terms of kernel calls.
Go look at what happens in the kernel when setsockopt
is called. You will eventually find the code that manipulates the kernel TCP tables directly. Once you understand that, you can write something similar. But your version will be much simplified because what you need is very specific. Be sure to respect and understand all the locking - that will be the only tricky bit.
Upvotes: 2