diff mbox

[ovs-dev,v2,10/24] datapath: compat: Update IPv6 in setup_udp_tunnel_sock()

Message ID 1467274002-61390-10-git-send-email-pshelar@ovn.org
State Superseded
Headers show

Commit Message

Pravin Shelar June 30, 2016, 8:06 a.m. UTC
Update setup_udp_tunnel_sock() to handle ipv6 sockets.

Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
---
 datapath/linux/compat/include/net/udp_tunnel.h | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

Comments

Jesse Gross June 30, 2016, 8:44 p.m. UTC | #1
On Thu, Jun 30, 2016 at 1:06 AM, Pravin B Shelar <pshelar@ovn.org> wrote:
> Update setup_udp_tunnel_sock() to handle ipv6 sockets.
>
> Signed-off-by: Pravin B Shelar <pshelar@ovn.org>

Acked-by: Jesse Gross <jesse@kernel.org>
diff mbox

Patch

diff --git a/datapath/linux/compat/include/net/udp_tunnel.h b/datapath/linux/compat/include/net/udp_tunnel.h
index 0f38c26..3f02c79 100644
--- a/datapath/linux/compat/include/net/udp_tunnel.h
+++ b/datapath/linux/compat/include/net/udp_tunnel.h
@@ -99,7 +99,20 @@  int rpl_udp_tunnel_xmit_skb(struct rtable *rt,
 #define udp_tunnel_sock_release rpl_udp_tunnel_sock_release
 void rpl_udp_tunnel_sock_release(struct socket *sock);
 
-#define udp_tunnel_encap_enable(sock) udp_encap_enable()
+#define udp_tunnel_encap_enable rpl_udp_tunnel_encap_enable
+static inline void udp_tunnel_encap_enable(struct socket *sock)
+{
+#if IS_ENABLED(CONFIG_IPV6)
+	if (sock->sk->sk_family == PF_INET6)
+#ifdef HAVE_IPV6_STUB
+		ipv6_stub->udpv6_encap_enable();
+#else
+		udpv6_encap_enable();
+#endif
+	else
+#endif
+		udp_encap_enable();
+}
 
 #if IS_ENABLED(CONFIG_IPV6)
 #define udp_tunnel6_xmit_skb rpl_udp_tunnel6_xmit_skb