name sercomm-based ar7 images (dg834/compatible) .img instead of .bin, because the...
[openwrt.git] / openwrt / target / linux / generic-2.6 / patches / 102-openswan-2.4.0.kernel-2.6-natt.patch
1 packaging/utils/nattpatch 2.6
2 --- /dev/null Tue Mar 11 13:02:56 2003
3 +++ nat-t/include/net/xfrmudp.h Mon Feb 9 13:51:03 2004
4 @@ -0,0 +1,10 @@
5 +/*
6 + * pointer to function for type that xfrm4_input wants, to permit
7 + * decoupling of XFRM from udp.c
8 + */
9 +#define HAVE_XFRM4_UDP_REGISTER
10 +
11 +typedef int (*xfrm4_rcv_encap_t)(struct sk_buff *skb, __u16 encap_type);
12 +extern int udp4_register_esp_rcvencap(xfrm4_rcv_encap_t func
13 + , xfrm4_rcv_encap_t *oldfunc);
14 +extern int udp4_unregister_esp_rcvencap(xfrm4_rcv_encap_t func);
15 --- /distros/kernel/linux-2.6.11.2/net/ipv4/Kconfig 2005-03-09 03:12:33.000000000 -0500
16 +++ swan26/net/ipv4/Kconfig 2005-04-04 18:46:13.000000000 -0400
17 @@ -351,2 +351,8 @@
18
19 +config IPSEC_NAT_TRAVERSAL
20 + bool "IPSEC NAT-Traversal (KLIPS compatible)"
21 + depends on INET
22 + ---help---
23 + Includes support for RFC3947/RFC3948 NAT-Traversal of ESP over UDP.
24 +
25 config IP_TCPDIAG
26 --- /distros/kernel/linux-2.6.11.2/./net/ipv4/udp.c 2005-03-09 03:11:09.000000000 -0500
27 +++ ./net/ipv4/udp.c 2005-04-09 20:46:46.000000000 -0400
28 @@ -109,2 +109,3 @@
29 #include <net/xfrm.h>
30 +#include <net/xfrmudp.h>
31
32 @@ -114,2 +115,4 @@
33
34 +static xfrm4_rcv_encap_t xfrm4_rcv_encap_func;
35 +
36 DEFINE_SNMP_STAT(struct udp_mib, udp_statistics);
37 @@ -894,2 +897,38 @@
38
39 +#if defined(CONFIG_XFRM) || defined(CONFIG_IPSEC_NAT_TRAVERSAL)
40 +
41 +/* if XFRM isn't a module, then register it directly. */
42 +#if 0 && !defined(CONFIG_XFRM_MODULE) && !defined(CONFIG_IPSEC_NAT_TRAVERSAL)
43 +static xfrm4_rcv_encap_t xfrm4_rcv_encap_func = xfrm4_rcv_encap;
44 +#else
45 +static xfrm4_rcv_encap_t xfrm4_rcv_encap_func = NULL;
46 +#endif
47 +
48 +int udp4_register_esp_rcvencap(xfrm4_rcv_encap_t func
49 + , xfrm4_rcv_encap_t *oldfunc)
50 +{
51 + if(oldfunc != NULL) {
52 + *oldfunc = xfrm4_rcv_encap_func;
53 + }
54 +
55 +#if 0
56 + if(xfrm4_rcv_encap_func != NULL)
57 + return -1;
58 +#endif
59 +
60 + xfrm4_rcv_encap_func = func;
61 + return 0;
62 +}
63 +
64 +int udp4_unregister_esp_rcvencap(xfrm4_rcv_encap_t func)
65 +{
66 + if(xfrm4_rcv_encap_func != func)
67 + return -1;
68 +
69 + xfrm4_rcv_encap_func = NULL;
70 + return 0;
71 +}
72 +#endif /* CONFIG_XFRM_MODULE || CONFIG_IPSEC_NAT_TRAVERSAL */
73 +
74 +
75 /* return:
76 @@ -901,5 +940,5 @@
77 {
78 -#ifndef CONFIG_XFRM
79 +#if !defined(CONFIG_XFRM) && !defined(CONFIG_IPSEC_NAT_TRAVERSAL)
80 return 1;
81 -#else
82 +#else /* either CONFIG_XFRM or CONFIG_IPSEC_NAT_TRAVERSAL */
83 struct udp_sock *up = udp_sk(sk);
84 @@ -915,3 +954,3 @@
85 if (udpdata > skb->tail)
86 - return 1;
87 + return 2;
88
89 @@ -919,3 +958,3 @@
90 if (!encap_type)
91 - return 1;
92 + return 3;
93
94 @@ -934,3 +973,3 @@
95 /* Must be an IKE packet.. pass it through */
96 - return 1;
97 + return 4;
98 break;
99 @@ -947,3 +986,3 @@
100 /* Must be an IKE packet.. pass it through */
101 - return 1;
102 + return 5;
103 break;
104 @@ -956,2 +995,4 @@
105 */
106 + if (skb_cloned(skb) && pskb_expand_head(skb, 0, 0, GFP_ATOMIC))
107 + return 0;
108
109 @@ -1019,5 +1060,9 @@
110 if (ret < 0) {
111 - /* process the ESP packet */
112 - ret = xfrm4_rcv_encap(skb, up->encap_type);
113 - UDP_INC_STATS_BH(UDP_MIB_INDATAGRAMS);
114 + if(xfrm4_rcv_encap_func != NULL) {
115 + ret = (*xfrm4_rcv_encap_func)(skb, up->encap_type);
116 + UDP_INC_STATS_BH(UDP_MIB_INDATAGRAMS);
117 + } else {
118 + UDP_INC_STATS_BH(UDP_MIB_INERRORS);
119 + ret = 1;
120 + }
121 return -ret;
122 @@ -1574 +1619,7 @@
123 #endif
124 +
125 +#if defined(CONFIG_IPSEC_NAT_TRAVERSAL)
126 +EXPORT_SYMBOL(udp4_register_esp_rcvencap);
127 +EXPORT_SYMBOL(udp4_unregister_esp_rcvencap);
128 +#endif
129 +
This page took 0.058944 seconds and 5 git commands to generate.