1

I try to use IP_TRANSPARENT socket option. But I got "IP_TRANSPARENT" was not declared in this scope. If I directly use its code (19) in the code, I got binding error as : "invalid argument". Should I recompile my kernel to support this option? If it is the case, I use kernel 2.6.32. I couldn't find any option in the kernel parameter interface.

Any thoughts?

Thanks,

Amir
  • 5,996
  • 13
  • 48
  • 61

1 Answers1

2

Using the value 19 if it is not defined by your C library's header files is ok, it's not what's causing it to return -EINVAL.

But there are a few kernel options that need to be enabled for this to work. To quote the documentation (in the kernel source, Documentation/networking/tproxy.txt):

This feature adds Linux 2.2-like transparent proxy support to current kernels. To use it, enable NETFILTER_TPROXY, the socket match and the TPROXY target in your kernel config. You will need policy routing too, so be sure to enable that as well.

You can find more information in that document, or read it online here: http://www.mjmwired.net/kernel/Documentation/networking/tproxy.txt

ThomasH
  • 1,085
  • 10
  • 12