So it looks like *almost* everything that is required is there already. The only thing needed is to actually be able to set the IP_TRANSPARENT socket option:
if(setsockopt(listen_fd, SOL_IP, IP_TRANSPARENT, &yes, sizeof(yes)) == -1) {...}
So, if I implemented the following method in src/main/c/io_netty_channel_epoll_Native.c:
JNIEXPORT void JNICALL Java_io_netty_channel_epoll_Native_setIpTransparent(JNIEnv* env, jclass clazz, jint fd, jint optval) {
setOption(env, fd, SOL_IP, IP_TRANSPARENT, &optval, sizeof(optval));
}
and the corresponding method and Channel Option on the Java side, It should just work. Fortunately, localAddress0() already exists to get the address that the socket thinks it is connected to!
I'm happy to take suggestions on what the method and option should be called, though.
Regards,
Rogan