aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic-2.6/patches/102-openswan-2.4.0.kernel-2.6-natt.patch
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2006-01-10 19:43:00 +0000
committerFelix Fietkau <nbd@openwrt.org>2006-01-10 19:43:00 +0000
commitfbc6b140a51f4faa9b995eb965b6e69ebb541f3f (patch)
tree4f317d291370cf0af876f446896c66a3a503be97 /target/linux/generic-2.6/patches/102-openswan-2.4.0.kernel-2.6-natt.patch
parentd9e36255b00d6bbcdedeba7ab9e22f37f8ed79bc (diff)
downloadupstream-fbc6b140a51f4faa9b995eb965b6e69ebb541f3f.tar.gz
upstream-fbc6b140a51f4faa9b995eb965b6e69ebb541f3f.tar.bz2
upstream-fbc6b140a51f4faa9b995eb965b6e69ebb541f3f.zip
large target/linux cleanup
git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@2877 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/generic-2.6/patches/102-openswan-2.4.0.kernel-2.6-natt.patch')
-rw-r--r--target/linux/generic-2.6/patches/102-openswan-2.4.0.kernel-2.6-natt.patch129
1 files changed, 129 insertions, 0 deletions
diff --git a/target/linux/generic-2.6/patches/102-openswan-2.4.0.kernel-2.6-natt.patch b/target/linux/generic-2.6/patches/102-openswan-2.4.0.kernel-2.6-natt.patch
new file mode 100644
index 0000000000..ab09e3c356
--- /dev/null
+++ b/target/linux/generic-2.6/patches/102-openswan-2.4.0.kernel-2.6-natt.patch
@@ -0,0 +1,129 @@
+packaging/utils/nattpatch 2.6
+--- /dev/null Tue Mar 11 13:02:56 2003
++++ nat-t/include/net/xfrmudp.h Mon Feb 9 13:51:03 2004
+@@ -0,0 +1,10 @@
++/*
++ * pointer to function for type that xfrm4_input wants, to permit
++ * decoupling of XFRM from udp.c
++ */
++#define HAVE_XFRM4_UDP_REGISTER
++
++typedef int (*xfrm4_rcv_encap_t)(struct sk_buff *skb, __u16 encap_type);
++extern int udp4_register_esp_rcvencap(xfrm4_rcv_encap_t func
++ , xfrm4_rcv_encap_t *oldfunc);
++extern int udp4_unregister_esp_rcvencap(xfrm4_rcv_encap_t func);
+--- /distros/kernel/linux-2.6.11.2/net/ipv4/Kconfig 2005-03-09 03:12:33.000000000 -0500
++++ swan26/net/ipv4/Kconfig 2005-04-04 18:46:13.000000000 -0400
+@@ -351,2 +351,8 @@
+
++config IPSEC_NAT_TRAVERSAL
++ bool "IPSEC NAT-Traversal (KLIPS compatible)"
++ depends on INET
++ ---help---
++ Includes support for RFC3947/RFC3948 NAT-Traversal of ESP over UDP.
++
+ config IP_TCPDIAG
+--- /distros/kernel/linux-2.6.11.2/./net/ipv4/udp.c 2005-03-09 03:11:09.000000000 -0500
++++ ./net/ipv4/udp.c 2005-04-09 20:46:46.000000000 -0400
+@@ -109,2 +109,3 @@
+ #include <net/xfrm.h>
++#include <net/xfrmudp.h>
+
+@@ -114,2 +115,4 @@
+
++static xfrm4_rcv_encap_t xfrm4_rcv_encap_func;
++
+ DEFINE_SNMP_STAT(struct udp_mib, udp_statistics);
+@@ -894,2 +897,38 @@
+
++#if defined(CONFIG_XFRM) || defined(CONFIG_IPSEC_NAT_TRAVERSAL)
++
++/* if XFRM isn't a module, then register it directly. */
++#if 0 && !defined(CONFIG_XFRM_MODULE) && !defined(CONFIG_IPSEC_NAT_TRAVERSAL)
++static xfrm4_rcv_encap_t xfrm4_rcv_encap_func = xfrm4_rcv_encap;
++#else
++static xfrm4_rcv_encap_t xfrm4_rcv_encap_func = NULL;
++#endif
++
++int udp4_register_esp_rcvencap(xfrm4_rcv_encap_t func
++ , xfrm4_rcv_encap_t *oldfunc)
++{
++ if(oldfunc != NULL) {
++ *oldfunc = xfrm4_rcv_encap_func;
++ }
++
++#if 0
++ if(xfrm4_rcv_encap_func != NULL)
++ return -1;
++#endif
++
++ xfrm4_rcv_encap_func = func;
++ return 0;
++}
++
++int udp4_unregister_esp_rcvencap(xfrm4_rcv_encap_t func)
++{
++ if(xfrm4_rcv_encap_func != func)
++ return -1;
++
++ xfrm4_rcv_encap_func = NULL;
++ return 0;
++}
++#endif /* CONFIG_XFRM_MODULE || CONFIG_IPSEC_NAT_TRAVERSAL */
++
++
+ /* return:
+@@ -901,5 +940,5 @@
+ {
+-#ifndef CONFIG_XFRM
++#if !defined(CONFIG_XFRM) && !defined(CONFIG_IPSEC_NAT_TRAVERSAL)
+ return 1;
+-#else
++#else /* either CONFIG_XFRM or CONFIG_IPSEC_NAT_TRAVERSAL */
+ struct udp_sock *up = udp_sk(sk);
+@@ -915,3 +954,3 @@
+ if (udpdata > skb->tail)
+- return 1;
++ return 2;
+
+@@ -919,3 +958,3 @@
+ if (!encap_type)
+- return 1;
++ return 3;
+
+@@ -934,3 +973,3 @@
+ /* Must be an IKE packet.. pass it through */
+- return 1;
++ return 4;
+ break;
+@@ -947,3 +986,3 @@
+ /* Must be an IKE packet.. pass it through */
+- return 1;
++ return 5;
+ break;
+@@ -956,2 +995,4 @@
+ */
++ if (skb_cloned(skb) && pskb_expand_head(skb, 0, 0, GFP_ATOMIC))
++ return 0;
+
+@@ -1019,5 +1060,9 @@
+ if (ret < 0) {
+- /* process the ESP packet */
+- ret = xfrm4_rcv_encap(skb, up->encap_type);
+- UDP_INC_STATS_BH(UDP_MIB_INDATAGRAMS);
++ if(xfrm4_rcv_encap_func != NULL) {
++ ret = (*xfrm4_rcv_encap_func)(skb, up->encap_type);
++ UDP_INC_STATS_BH(UDP_MIB_INDATAGRAMS);
++ } else {
++ UDP_INC_STATS_BH(UDP_MIB_INERRORS);
++ ret = 1;
++ }
+ return -ret;
+@@ -1574 +1619,7 @@
+ #endif
++
++#if defined(CONFIG_IPSEC_NAT_TRAVERSAL)
++EXPORT_SYMBOL(udp4_register_esp_rcvencap);
++EXPORT_SYMBOL(udp4_unregister_esp_rcvencap);
++#endif
++