Does anyone know if there's an existing library out there that will allow me to make a call to getsockopt to get the destination IP for a socket that iptables has rerouted through my Java application?
Here's a similar question on the Netty mailing list that went unanswered.
The call in c would look something like:
getsockopt(ctx->client.fd, SOL_IP,
SO_ORIGINAL_DST, &SANY_ADDR(addr), &SANY_LEN(addr))
Example of how to do it with JNI also welcome.