Repository: netty/netty
Issue: Add support for IP_TRANSPARENT socket option for UDP connections

Push request at #6835 does not include 'transparent proxy' mode for UDP. setOption() function in EpollDatagramChannelConfig should include IP_TRANSPARENT option.

Issue comments:
@kubuzetto PRs welcome
Fixed via https://github.com/netty/netty/pull/7872

Pull request review comments:
revert
revert?
Yes please revert this change ... 
Do you mean the entire PR? Why?
No just the one line change above the comment

Patch that resolved the issue:
diff --git a/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollDatagramChannelConfig.java b/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollDatagramChannelConfig.java
index ddb206551df..0f8e86ec1d9 100644
--- a/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollDatagramChannelConfig.java
+++ b/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollDatagramChannelConfig.java
@@ -23,6 +23,7 @@
 import io.netty.channel.RecvByteBufAllocator;
 import io.netty.channel.WriteBufferWaterMark;
 import io.netty.channel.socket.DatagramChannelConfig;
+
 import java.io.IOException;
 import java.net.InetAddress;
 import java.net.NetworkInterface;
@@ -48,7 +49,7 @@ public Map<ChannelOption<?>, Object> getOptions() {
                 ChannelOption.SO_REUSEADDR, ChannelOption.IP_MULTICAST_LOOP_DISABLED,
                 ChannelOption.IP_MULTICAST_ADDR, ChannelOption.IP_MULTICAST_IF, ChannelOption.IP_MULTICAST_TTL,
                 ChannelOption.IP_TOS, ChannelOption.DATAGRAM_CHANNEL_ACTIVE_ON_REGISTRATION,
-                EpollChannelOption.SO_REUSEPORT);
+                EpollChannelOption.SO_REUSEPORT, EpollChannelOption.IP_TRANSPARENT);
     }
 
     @SuppressWarnings({ "unchecked", "deprecation" })
@@ -87,6 +88,9 @@ public <T> T getOption(ChannelOption<T> option) {
         if (option == EpollChannelOption.SO_REUSEPORT) {
             return (T) Boolean.valueOf(isReusePort());
         }
+        if (option == EpollChannelOption.IP_TRANSPARENT) {
+            return (T) Boolean.valueOf(isIpTransparent());
+        }
         return super.getOption(option);
     }
 
@@ -117,6 +121,8 @@ public <T> boolean setOption(ChannelOption<T> option, T value) {
             setActiveOnOpen((Boolean) value);
         } else if (option == EpollChannelOption.SO_REUSEPORT) {
             setReusePort((Boolean) value);
+        } else if (option == EpollChannelOption.IP_TRANSPARENT) {
+            setIpTransparent((Boolean) value);
         } else {
             return super.setOption(option, value);
         }
@@ -371,4 +377,30 @@ public EpollDatagramChannelConfig setReusePort(boolean reusePort) {
             throw new ChannelException(e);
         }
     }
+
+    /**
+     * Returns {@code true} if <a href="http://man7.org/linux/man-pages/man7/ip.7.html">IP_TRANSPARENT</a> is enabled,
+     * {@code false} otherwise.
+     */
+    public boolean isIpTransparent() {
+        try {
+            return datagramChannel.socket.isIpTransparent();
+        } catch (IOException e) {
+            throw new ChannelException(e);
+        }
+    }
+
+    /**
+     * If {@code true} is used <a href="http://man7.org/linux/man-pages/man7/ip.7.html">IP_TRANSPARENT</a> is enabled,
+     * {@code false} for disable it. Default is disabled.
+     */
+    public EpollDatagramChannelConfig setIpTransparent(boolean ipTransparent) {
+        try {
+            datagramChannel.socket.setIpTransparent(ipTransparent);
+            return this;
+        } catch (IOException e) {
+            throw new ChannelException(e);
+        }
+    }
+
 }


Test patch: